使用SubSonic3.0一段时间了,一直都想找机会测试一下各种查询分页速度,对比一下插件的查询效率到底怎么样,所以昨天写好了测试程序,准备好1K、1W、10W、50W和100W记录的数据表,早上详细做了测试。
本机硬件配置:
英特尔 第三代酷睿 i5-3470(3.2GHz 四核) 华硕 P8B75-V 8G金士顿DDR3 1600MHz内存 希捷 ST1000DM003-1CH162(1T / 7200转/分)
本机软件配置:
Win7 + SQL2005 + VS2010
测试方法:使用5种常用分页方式进行查询,查看第一页、中间页与最后页,然后记录查询消耗时间,每页查询10次后了平均值
存储过程分页程序用的是网上通用版本
测试代码:
Test.aspx页面
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="Solution.Web.WebManage.Test" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:label ID="Label1" runat="server" text="总记录数量"></asp:label><asp:label ID="labTotle" runat="server" text="Label"></asp:label><br/> <asp:label ID="Label2" runat="server" text="总页面数量"></asp:label><asp:label ID="labPageSize" runat="server" text="Label"></asp:label><br/> </div> <div> <asp:label ID="labGetPaged" runat="server" text="Label"></asp:label><br /> <asp:label ID="labQuery" runat="server" text="Label"></asp:label><br /> <asp:label ID="labADO" runat="server" text="Label"></asp:label><br /> <asp:label ID="labSql" runat="server" text="Label"></asp:label><br /> <asp:label ID="labTime" runat="server" text="Label"></asp:label> <br /> <br /> <br /> </div> <div> <asp:Button ID="Button1" runat="server" Text="第一页" onclick="Button1_Click" /> <asp:Button ID="Button2" runat="server" Text="中间页" onclick="Button2_Click" /> <asp:Button ID="Button3" runat="server" Text="最后页" onclick="Button3_Click" /> </div> </form> </body> </html>