国家现在开始抓盗版了,无奈,.net平台实在是比较贵的,但又不像放弃.net,只能把.netframework换成mono,把sql server换成postgresql,刚刚着手学习
代码很简单,但测试结果却不能让人满意:
postgresql:531.25,mssql:15.625
postgresql:515.625,mssql:15.625
postgresql:531.25,mssql:15.625
postgresql:515.625,mssql:0
postgresql:531.25,mssql:0
看来免费的东西还是不好使啊
今天测试用
npgsql 连postgresql的效率
对比
ado.net连sql server
代码很简单:
double
firstms
=
0.0
,secondms
=
0.0
;
for ( int i = 0 ; i < 1000 ; i ++ )
{
Npgsql.NpgsqlConnection conn = new NpgsqlConnection(ConnStr);
conn.Open();
conn.Close();
}
DateTime endtime = DateTime.Now;
firstms = endtime.Subtract(begintime).TotalMilliseconds;
DateTime begintime1 = DateTime.Now;
for ( int i = 0 ; i < 1000 ; i ++ )
{
SqlConnection sqlConn = new SqlConnection(sqlConnStr);
sqlConn.Open();
sqlConn.Close();
}
DateTime endtime1 = DateTime.Now;
secondms = endtime1.Subtract(begintime1).TotalMilliseconds;
Response.Write( string .Format( " postgresql:{0},mssql:{1} " ,firstms,secondms));
for ( int i = 0 ; i < 1000 ; i ++ )
{
Npgsql.NpgsqlConnection conn = new NpgsqlConnection(ConnStr);
conn.Open();
conn.Close();
}
DateTime endtime = DateTime.Now;
firstms = endtime.Subtract(begintime).TotalMilliseconds;
DateTime begintime1 = DateTime.Now;
for ( int i = 0 ; i < 1000 ; i ++ )
{
SqlConnection sqlConn = new SqlConnection(sqlConnStr);
sqlConn.Open();
sqlConn.Close();
}
DateTime endtime1 = DateTime.Now;
secondms = endtime1.Subtract(begintime1).TotalMilliseconds;
Response.Write( string .Format( " postgresql:{0},mssql:{1} " ,firstms,secondms));
代码很简单,但测试结果却不能让人满意:
postgresql:531.25,mssql:15.625
postgresql:515.625,mssql:15.625
postgresql:531.25,mssql:15.625
postgresql:515.625,mssql:0
postgresql:531.25,mssql:0
看来免费的东西还是不好使啊