|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
数据挖掘有点高深的,主要估计就是使用一些算法提取一些实用的数据。学好数据挖掘的话可以应聘baidu或者google,但是一般人家对算法的要求听高的。你最好还是学点应用型的吧。这种主要是研究型的。ado|对照|速率想在开辟中利用NHibernate,但忧虑在功能上的成绩,对查询的速率和Ado.Net举行了一下复杂的对照。历程和代码以下形貌,因为懂得不深,暂不做结论,但愿人人给点定见。
NHibernateHQL体例:830笔记录,加载工夫(ms):3334.7952绑定IList工夫(ms):70.1008
Ado.NetDbDataAdapter体例:830笔记录;加载工夫(ms):40.0576绑定IList工夫(ms):80.1152
测试情况:WinForm体例,数据库也在本机
硬件:CPU--1.2GAMDduron(tm)RAM--384MDDR266
软件:WindowsServer2003,SqlServer2000,VisualStudio.Net2005
测试代码下载http://www.ckuyun.com/Files/liuyuanhuo/NHibernateTest_Performance.rar
测试的代码是在
子非鱼NHibernate进修http://sifang2004.cnblogs.com/archive/2005/09/05/230713.aspx
NHibernate博客园专题之一http://www.ckuyun.com/Files/sifang2004/NHibernateTest.rar
中下载的示例中作修正的。
测试由两个工程构成,
一.NHibernateTest工程,仅修正两个中央
1.正文Order.hbm.xml中_Items相干的<bag元素
2.在Order.cs增添上面两个办法
/**////<summary>
///利用NHibernateHQL体例查询
///</summary>
///<returns>IList,定单工具汇合</returns>
publicIListLoadAllByNHibernate()
{
IListorders=ObjectLoader.Find("fromOrder",null);
returnorders;
}
/**////<summary>
///利用Ado.NetDbDataAdapter体例查询
///</summary>
///<returns>DataTable,定单数据表</returns>
publicDataTableLoadAllByAdoNet()
{
DataTabledtOrders=newDataTable();
DbConnectiondbConnection=newSqlConnection();
dbConnection.ConnectionString=
@"Server=AndyAndy;initialcatalog=Northwind;Userid=sa;Password=sa";
DbCommanddbCommand=newSqlCommand();
dbCommand.Connection=dbConnection;
dbCommand.CommandType=CommandType.Text;
dbCommand.CommandText="SELECT*FROMOrders";
DbDataAdapterdataAdapter=newSqlDataAdapter();
dataAdapter.SelectCommand=dbCommand;
dataAdapter.Fill(dtOrders);
returndtOrders;
}
二.增加一个NHibernateTestUI工程,援用NHibernateTest,从NHibernateTest复制一份app.config到NHibernateTestUI,修正毗连串,然后增加一个窗体类,加了两个按钮一个DataGridView,两个按钮分离测试Ado.NetDbDataAdapter体例和NHibernateHQL体例的加载工夫,测试代码以下:
usingSystem;
usingSystem.Collections;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Text;
usingSystem.Windows.Forms;
namespaceNHibernateTestUI
{
publicpartialclassOrderFrm:Form
{
publicOrderFrm()
{
InitializeComponent();
}
NHibernateTest.Orderorder=newNHibernateTest.Order();
/**////<summary>
///利用NHibernateHQL体例查询
///</summary>
privatevoidbtnNHLoad_Click(objectsender,EventArgse)
{
stringstrOutput="";
//测试加载数据工夫
DateTimedtStart=System.DateTime.Now;
IListorders=order.LoadAllByNHibernate();//利用NHibernateHQL体例查询
DateTimedtEnd=System.DateTime.Now;
TimeSpants=dtEnd-dtStart;
strOutput+="NHibernateHQL体例:"
+orders.Count+"笔记录,加载工夫(ms):"
+ts.TotalMilliseconds;
//测试绑定命据工夫
dtStart=System.DateTime.Now;
this.dgvOrders.DataSource=orders;
dtEnd=System.DateTime.Now;
ts=dtEnd-dtStart;
strOutput+="绑定IList工夫:"+ts.TotalMilliseconds;
Console.WriteLine(strOutput);
}
/**////<summary>
///利用Ado.NetDbDataAdapter体例查询
///</summary>
privatevoidbtnADOLoad_Click(objectsender,EventArgse)
{
stringstrOutput="";
//测试加载数据工夫
DateTimedtStart=System.DateTime.Now;
DataTabledtOrders=order.LoadAllByAdoNet();//利用Ado.NetDbDataAdapter体例查询
DateTimedtEnd=System.DateTime.Now;
TimeSpants=dtEnd-dtStart;
strOutput+="Ado.NetDbDataAdapter体例:"
+dtOrders.Rows.Count+"笔记录;加载工夫(ms):"
+ts.TotalMilliseconds;
//测试绑定命据工夫
dtStart=System.DateTime.Now;
this.dgvOrders.DataSource=dtOrders;
dtEnd=System.DateTime.Now;
ts=dtEnd-dtStart;
strOutput+="绑定IList工夫:"+ts.TotalMilliseconds;
Console.WriteLine(strOutput);
}
}
}
运转后界面以下:
在界面两个按钮点击屡次后,二者的查询工夫不乱,能够作为对照。上面是输入:
NHibernate:selectorder0_.orderIdasorderId,order0_.shippedDateasshippedD4_,order0_.shipPostalCodeasshipPos10_,order0_.requiredDateasrequired3_,order0_.shipCountryasshipCou11_,order0_.shipViaasshipVia,order0_.orderDateasorderDate,order0_.shipAddressasshipAddr7_,order0_.shipRegionasshipRegion,order0_.shipNameasshipName,order0_.shipCityasshipCity,order0_.customerIdascustomerId,order0_.freightasfreight,order0_.employeeIdasemployeeIdfromOrdersorder0_
NHibernateHQL体例:830笔记录,加载工夫(ms):3334.7952绑定IList工夫:70.1008
NHibernate:selectorder0_.orderIdasorderId,order0_.shippedDateasshippedD4_,order0_.shipPostalCodeasshipPos10_,order0_.requiredDateasrequired3_,order0_.shipCountryasshipCou11_,order0_.shipViaasshipVia,order0_.orderDateasorderDate,order0_.shipAddressasshipAddr7_,order0_.shipRegionasshipRegion,order0_.shipNameasshipName,order0_.shipCityasshipCity,order0_.customerIdascustomerId,order0_.freightasfreight,order0_.employeeIdasemployeeIdfromOrdersorder0_
NHibernateHQL体例:830笔记录,加载工夫(ms):3304.752绑定IList工夫:70.1008
NHibernate:selectorder0_.orderIdasorderId,order0_.shippedDateasshippedD4_,order0_.shipPostalCodeasshipPos10_,order0_.requiredDateasrequired3_,order0_.shipCountryasshipCou11_,order0_.shipViaasshipVia,order0_.orderDateasorderDate,order0_.shipAddressasshipAddr7_,order0_.shipRegionasshipRegion,order0_.shipNameasshipName,order0_.shipCityasshipCity,order0_.customerIdascustomerId,order0_.freightasfreight,order0_.employeeIdasemployeeIdfromOrdersorder0_
NHibernateHQL体例:830笔记录,加载工夫(ms):3354.824绑定IList工夫:80.1152
Ado.NetDbDataAdapter体例:830笔记录;加载工夫(ms):40.0576绑定IList工夫:80.1152
Ado.NetDbDataAdapter体例:830笔记录;加载工夫(ms):40.0576绑定IList工夫:90.1296
Ado.NetDbDataAdapter体例:830笔记录;加载工夫(ms):30.0432绑定IList工夫:90.1296
NHibernate:selectorder0_.orderIdasorderId,order0_.shippedDateasshippedD4_,order0_.shipPostalCodeasshipPos10_,order0_.requiredDateasrequired3_,order0_.shipCountryasshipCou11_,order0_.shipViaasshipVia,order0_.orderDateasorderDate,order0_.shipAddressasshipAddr7_,order0_.shipRegionasshipRegion,order0_.shipNameasshipName,order0_.shipCityasshipCity,order0_.customerIdascustomerId,order0_.freightasfreight,order0_.employeeIdasemployeeIdfromOrdersorder0_
NHibernateHQL体例:830笔记录,加载工夫(ms):3334.7952绑定IList工夫:70.1008
Ado.NetDbDataAdapter体例:830笔记录;加载工夫(ms):50.072绑定IList工夫:90.1296
别的在网上找了一下关于NHibernate功能的会商的有,
http://kevin-y.cnblogs.com/archive/2006/02/08/327164.html
http://wljcan.cnblogs.com/archive/2005/05/14/155495.aspx
很少,但愿能有已做过NHibernate考量的妙手供应点门路,十分感激。
捆绑编译器。用户不需要受制于厂家,自己就能将程序在新平台上编译运行。除了牛B轰轰的linux,估计也没有系统捆绑c/c++的编译器,而且许多新平台都无法支持复杂的c/c++编译器在上面直接运行。 |
|