![]() | CYQ.Data componentsCYQ.Data support multi-database application [Txt,Xml,Access, MSSQL, Oracle,SQLite,MySql], help easily and quickly to develop your project |
CYQ.Data 批量添加数据性能测试
Technology exchange |
|
|
| #TopicOwner |
今天有网友火晋地同学进了CYQ.Data官方群了,他正在折腾了一个各大ORM性能测试的比较的软件,如下图 折腾的种类也不少:
感觉这软件折腾的不错~~~值的期待~~~ 另外,他指出CYQ.Data 在他的软件里表现不佳~~~~ 所以我要了他的测试实例看看是怎么写的测试代码: 测试的过程,大体是开了N个线程,循环N次执行这样的函数。 找到表现不佳的原因,并解决: 中间纷纷绕绕的讲了一些各大ORM测试的实例编写不同问题,不过有一句,倒引起了我的注意,说平均400毫秒左右。 于是我本地测试了一下,结果找出一个小BUG,这个小BUG在每次new MAction时产生个被捕获的小异常,这个小异常不影响使用,但会占用2毫秒时间~~~ 所以整个评测都是不断的new MAction的情况,就是大事件了,这就是整体评测都不佳的原因了。
OK,修正这个小Bug后,下面来演示一下批量插入功能: 看看1万条数据,插入需要多长时间: 数据库为MSSQL 2005 CPU为i3,4G内存,数据表Consumer共4个字段。 每个示例前后都会truncate table Consumer;
第一种编码方法:通过不断的new MAction来实现插入,1万条用了6秒多,平均每秒插入1600条左右:
第二种编码方法:把for往里面移动,先不开启事务,1万条用了4秒多,平均每秒插入2500条左右: ![]()
第三种编码码方式,开启启事务呢,1万条用了2秒多,平均每秒插入4000条左右:
第四种编码方式:使用MDataTable的实现批量插入,1万条用了0.6秒多,平均每秒插入2万条左右: 事实上,时间是花在数据的实体转Table的过程,如果把这一块时间分出,只计算数据库批量插入的时间: 10万条用了0.8秒多,平均每秒插入10万条以上:
总结: 今天的测试,仅是做为样式供参考,不同的编码方式,实际上产生的性能点不同的,根据项目需要编程才是重点。 从07年开始写ORM框架,大大小小的框架写过很种风格,但真正的精华作品,却仅此一种。 另外其它多种ORM类型的比较,就等火晋地同学之文章了。 ![]() |
游客[注册][202.105.205.*]2015/4/8 9:19:16 | #2 | |
![]() | 我想问一下,主从表添加怎样处理 |
游客[注册][61.48.184.*]2013/9/23 0:04:00 | #1 | |
![]() | 必须用这个框架打天下 |
Post Comment
Bulletin
Article Search
Categories
- Platform for dynamic (20)
- Feedback (9)
- Guide (33)
- Principles (19)
- Project-Case (8)
- Business & Buy (2)
- Technology exchange (45)
New Article
- CYQ.Data Components Getting Started Guide [Part 5]-[MProc Execute Stored Procedures or SQL]
- CYQ.Data Components Getting Started Guide [Part 4]-[MAction Insert Delete Update]
- CYQ.Data Components Getting Started Guide [Part 3]-[MAction Get And Set Value]
- CYQ.Data Components Getting Started Guide [Part 2]-[MAction Data Query- Fill And Select]
- CYQ.Data Components Getting Started Guide [Part 1]
New Comment
- When some one searches for his necessary thing, therefore he/she wishes to be available that in detail, so that thing is maintained over here.
- This is my first time pay a quick visit at here and i am in fact happy to read everthing at alone place.
- I truly appreciate this blog article.Really thank you! Cool.
- please pay a visit to the web sites we follow, like this one particular, as it represents our picks in the web
- Really enjoyed this post.Really thank you!
- Really enjoyed this article.Really looking forward to read more. Great.
- poker bonuses What are the norms of copyright of web content? How as it different from Patent?
- Wow! Thank you! I permanently needed to write on my blog something like that. Can I implement a fragment of your post to my site?
- This website was how do I say it? Relevant!! Finally I ave found something that helped me. Cheers!
- I was reading through some of your content on this internet site and I believe this web site is very informative ! Continue posting.