扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:网页教学网 来源:网页教学网 2007年9月6日
关键字: NHibernate ADO 查询
NHibernate HQL方式 : 830 条记录, 加载时间(ms) : 3334.7952 绑定IList时间(ms) : 70.1008
Ado.Net DbDataAdapter方式 : 830 条记录; 加载时间(ms) : 40.0576 绑定IList时间(ms) : 80.1152
测试环境:WinForm方式,数据库也在本机
硬件:CPU -- 1.2G AMD duron(tm) RAM -- 384M DDR266
软件:Windows Server 2003, Sql Server 2000,Visual Studio.Net 2005
测试代码下载http://www.cnblogs.com/Files/liuyuanhuo/NHibernateTest_Performance.rar
测试的代码是在子非鱼 NHibernate学习http://sifang2004.cnblogs.com/archive/2005/09/05/230713.aspx
NHibernate 博客园专题之一http://www.cnblogs.com/Files/sifang2004/NHibernateTest.rar中下载的示例中作修改的。
测试由两个工程组成,
一.NHibernateTest工程,仅修改两个地方
1.注释Order.hbm.xml中_Items相关的<bag元素
2.在Order.cs增加下面两个方法
|
|
运行后界面如下:
在界面两个按钮点击多次后,两者的查询时间稳定,可以作为比较。下面是输出:
NHibernate :select order0_.orderId as orderId, order0_.shippedDate as shippedD4_, order0_.shipPostalCode as shipPos10_, order0_.requiredDate as required3_, order0_.shipCountry as shipCou11_, order0_.shipVia as shipVia, order0_.orderDate as orderDate, order0_.shipAddress as shipAddr7_, order0_.shipRegion as shipRegion, order0_.shipName as shipName, order0_.shipCity as shipCity, order0_.customerId as customerId, order0_.freight as freight, order0_.employeeId as employeeId from Orders order0_
NHibernate HQL方式 : 830 条记录, 加载时间(ms) : 3334.7952 绑定IList时间 : 70.1008
NHibernate :select order0_.orderId as orderId, order0_.shippedDate as shippedD4_, order0_.shipPostalCode as shipPos10_, order0_.requiredDate as required3_, order0_.shipCountry as shipCou11_, order0_.shipVia as shipVia, order0_.orderDate as orderDate, order0_.shipAddress as shipAddr7_, order0_.shipRegion as shipRegion, order0_.shipName as shipName, order0_.shipCity as shipCity, order0_.customerId as customerId, order0_.freight as freight, order0_.employeeId as employeeId from Orders order0_
NHibernate HQL方式 : 830 条记录, 加载时间(ms) : 3304.752 绑定IList时间 : 70.1008
NHibernate :select order0_.orderId as orderId, order0_.shippedDate as shippedD4_, order0_.shipPostalCode as shipPos10_, order0_.requiredDate as required3_, order0_.shipCountry as shipCou11_, order0_.shipVia as shipVia, order0_.orderDate as orderDate, order0_.shipAddress as shipAddr7_, order0_.shipRegion as shipRegion, order0_.shipName as shipName, order0_.shipCity as shipCity, order0_.customerId as customerId, order0_.freight as freight, order0_.employeeId as employeeId from Orders order0_
NHibernate HQL方式 : 830 条记录, 加载时间(ms) : 3354.824 绑定IList时间 : 80.1152
Ado.Net DbDataAdapter方式 : 830 条记录; 加载时间(ms) : 40.0576 绑定IList时间 : 80.1152
Ado.Net DbDataAdapter方式 : 830 条记录; 加载时间(ms) : 40.0576 绑定IList时间 : 90.1296
Ado.Net DbDataAdapter方式 : 830 条记录; 加载时间(ms) : 30.0432 绑定IList时间 : 90.1296
NHibernate :select order0_.orderId as orderId, order0_.shippedDate as shippedD4_, order0_.shipPostalCode as shipPos10_, order0_.requiredDate as required3_, order0_.shipCountry as shipCou11_, order0_.shipVia as shipVia, order0_.orderDate as orderDate, order0_.shipAddress as shipAddr7_, order0_.shipRegion as shipRegion, order0_.shipName as shipName, order0_.shipCity as shipCity, order0_.customerId as customerId, order0_.freight as freight, order0_.employeeId as employeeId from Orders order0_
NHibernate HQL方式 : 830 条记录, 加载时间(ms) : 3334.7952 绑定IList时间 : 70.1008
Ado.Net DbDataAdapter方式 : 830 条记录; 加载时间(ms) : 50.072 绑定IList时间 : 90.1296
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者