Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Fetched 31465 LLBLGen Pro v3.5 entities from the DB. Took 2886ms
- Fetched 31465 LLBLGen Pro v3.5 entities from the DB. Took 1319ms
- Fetched 31465 LLBLGen Pro v3.5 entities from the DB. Took 1331ms
- Fetched 31465 LLBLGen Pro v3.5 entities from the DB. Took 1224ms
- Fetched 31465 LLBLGen Pro v3.5 entities from the DB. Took 1208ms
- Fetched 31465 LLBLGen Pro v3.5 entities from the DB. Took 1270ms
- Fetched 31465 LLBLGen Pro v3.5 entities from the DB. Took 1207ms
- Fetched 31465 LLBLGen Pro v3.5 entities from the DB. Took 1232ms
- Fetched 31465 LLBLGen Pro v3.5 entities from the DB. Took 1197ms
- Fetched 31465 LLBLGen Pro v3.5 entities from the DB. Took 1284ms
- Fetched 31465 LLBLGen Pro v4 entities from the DB. Took 1262ms
- Fetched 31465 LLBLGen Pro v4 entities from the DB. Took 921ms
- Fetched 31465 LLBLGen Pro v4 entities from the DB. Took 830ms
- Fetched 31465 LLBLGen Pro v4 entities from the DB. Took 818ms
- Fetched 31465 LLBLGen Pro v4 entities from the DB. Took 842ms
- Fetched 31465 LLBLGen Pro v4 entities from the DB. Took 872ms
- Fetched 31465 LLBLGen Pro v4 entities from the DB. Took 794ms
- Fetched 31465 LLBLGen Pro v4 entities from the DB. Took 879ms
- Fetched 31465 LLBLGen Pro v4 entities from the DB. Took 805ms
- Fetched 31465 LLBLGen Pro v4 entities from the DB. Took 862ms
- Fetched 31465 LLBLGen Pro v4 entities with resultset caching from the DB. Took 1004ms
- Fetched 31465 LLBLGen Pro v4 entities with resultset caching from the DB. Took 310ms
- Fetched 31465 LLBLGen Pro v4 entities with resultset caching from the DB. Took 280ms
- Fetched 31465 LLBLGen Pro v4 entities with resultset caching from the DB. Took 208ms
- Fetched 31465 LLBLGen Pro v4 entities with resultset caching from the DB. Took 311ms
- Fetched 31465 LLBLGen Pro v4 entities with resultset caching from the DB. Took 255ms
- Fetched 31465 LLBLGen Pro v4 entities with resultset caching from the DB. Took 277ms
- Fetched 31465 LLBLGen Pro v4 entities with resultset caching from the DB. Took 264ms
- Fetched 31465 LLBLGen Pro v4 entities with resultset caching from the DB. Took 292ms
- Fetched 31465 LLBLGen Pro v4 entities with resultset caching from the DB. Took 253ms
- Fetched 31465 objects from Dapper in list from the DB. Took 807ms
- Fetched 31465 objects from Dapper in list from the DB. Took 714ms
- Fetched 31465 objects from Dapper in list from the DB. Took 683ms
- Fetched 31465 objects from Dapper in list from the DB. Took 689ms
- Fetched 31465 objects from Dapper in list from the DB. Took 649ms
- Fetched 31465 objects from Dapper in list from the DB. Took 635ms
- Fetched 31465 objects from Dapper in list from the DB. Took 665ms
- Fetched 31465 objects from Dapper in list from the DB. Took 632ms
- Fetched 31465 objects from Dapper in list from the DB. Took 652ms
- Fetched 31465 objects from Dapper in list from the DB. Took 648ms
- Fetched 31465 Linq to Sql entities from the DB. Took 738ms
- Fetched 31465 Linq to Sql entities from the DB. Took 625ms
- Fetched 31465 Linq to Sql entities from the DB. Took 622ms
- Fetched 31465 Linq to Sql entities from the DB. Took 604ms
- Fetched 31465 Linq to Sql entities from the DB. Took 631ms
- Fetched 31465 Linq to Sql entities from the DB. Took 657ms
- Fetched 31465 Linq to Sql entities from the DB. Took 600ms
- Fetched 31465 Linq to Sql entities from the DB. Took 684ms
- Fetched 31465 Linq to Sql entities from the DB. Took 658ms
- Fetched 31465 Linq to Sql entities from the DB. Took 609ms
- Fetched 31465 NHibernate v3.3.1.4 entities from the DB. Took 4321ms
- Fetched 31465 NHibernate v3.3.1.4 entities from the DB. Took 1566ms
- Fetched 31465 NHibernate v3.3.1.4 entities from the DB. Took 1541ms
- Fetched 31465 NHibernate v3.3.1.4 entities from the DB. Took 1613ms
- Fetched 31465 NHibernate v3.3.1.4 entities from the DB. Took 1563ms
- Fetched 31465 NHibernate v3.3.1.4 entities from the DB. Took 1503ms
- Fetched 31465 NHibernate v3.3.1.4 entities from the DB. Took 1563ms
- Fetched 31465 NHibernate v3.3.1.4 entities from the DB. Took 1559ms
- Fetched 31465 NHibernate v3.3.1.4 entities from the DB. Took 1499ms
- Fetched 31465 NHibernate v3.3.1.4 entities from the DB. Took 1596ms
- Fetched 31465 entity framework v5 entities from the DB. Took 2199ms
- Fetched 31465 entity framework v5 entities from the DB. Took 1222ms
- Fetched 31465 entity framework v5 entities from the DB. Took 1182ms
- Fetched 31465 entity framework v5 entities from the DB. Took 1110ms
- Fetched 31465 entity framework v5 entities from the DB. Took 1145ms
- Fetched 31465 entity framework v5 entities from the DB. Took 1164ms
- Fetched 31465 entity framework v5 entities from the DB. Took 1056ms
- Fetched 31465 entity framework v5 entities from the DB. Took 1104ms
- Fetched 31465 entity framework v5 entities from the DB. Took 1173ms
- Fetched 31465 entity framework v5 entities from the DB. Took 1133ms
- Fetched 31465 handcoded objects in list from the DB. Took 675ms
- Fetched 31465 handcoded objects in list from the DB. Took 644ms
- Fetched 31465 handcoded objects in list from the DB. Took 641ms
- Fetched 31465 handcoded objects in list from the DB. Took 615ms
- Fetched 31465 handcoded objects in list from the DB. Took 696ms
- Fetched 31465 handcoded objects in list from the DB. Took 651ms
- Fetched 31465 handcoded objects in list from the DB. Took 633ms
- Fetched 31465 handcoded objects in list from the DB. Took 641ms
- Fetched 31465 handcoded objects in list from the DB. Took 624ms
- Fetched 31465 handcoded objects in list from the DB. Took 657ms
- Fetched 31465 rows in datatable from the DB. Took 698ms
- Fetched 31465 rows in datatable from the DB. Took 680ms
- Fetched 31465 rows in datatable from the DB. Took 664ms
- Fetched 31465 rows in datatable from the DB. Took 657ms
- Fetched 31465 rows in datatable from the DB. Took 672ms
- Fetched 31465 rows in datatable from the DB. Took 671ms
- Fetched 31465 rows in datatable from the DB. Took 694ms
- Fetched 31465 rows in datatable from the DB. Took 672ms
- Fetched 31465 rows in datatable from the DB. Took 664ms
- Fetched 31465 rows in datatable from the DB. Took 690ms
- CODE:
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Data;
- using System.Data.SqlClient;
- using System.Diagnostics;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using AdventureWorks.Dal.Adapter.DatabaseSpecific;
- using AdventureWorks.Dal.Adapter.EntityClasses;
- using AdventureWorks.Dal.Adapter.HelperClasses;
- using EF.Bencher;
- using L2S.Bencher;
- using NH.Bencher;
- using NHibernate;
- using NHibernate.Linq;
- using Dapper;
- using AdventureWorks.Dal.Adapter.FactoryClasses;
- using SD.LLBLGen.Pro.QuerySpec;
- using SD.LLBLGen.Pro.QuerySpec.Adapter;
- using SD.LLBLGen.Pro.ORMSupportClasses;
- namespace RawBencher
- {
- class Program
- {
- public static string ConnectionString = @"data source=zeusVM\SQLSERVER2005;initial catalog=AdventureWorks;integrated security=SSPI;persist security info=False;packet size=4096";
- static void Main(string[] args)
- {
- CacheController.RegisterCache(ConnectionString, new ResultsetCache());
- int loopAmount = 10;
- for(int i = 0; i < loopAmount; i++)
- {
- FetchSalesOrderHeaderEntitiesv35();
- }
- for(int i = 0; i < loopAmount; i++)
- {
- FetchSalesOrderHeaderEntities();
- }
- for(int i = 0; i < loopAmount; i++)
- {
- FetchSalesOrderHeaderEntitiesWithCaching();
- }
- for(int i = 0; i < loopAmount; i++)
- {
- FetchSalesOrderHeaderDapper();
- }
- for(int i = 0; i < loopAmount; i++)
- {
- FetchSalesOrderHeaderL2S();
- }
- for(int i = 0; i < loopAmount; i++)
- {
- FetchSalesOrderHeaderNH();
- }
- for(int i = 0; i < loopAmount; i++)
- {
- FetchSalesOrderHeaderEF();
- }
- for(int i = 0; i < loopAmount; i++)
- {
- FetchSalesOrderHeaderHandCoded();
- }
- for(int i = 0; i < loopAmount; i++)
- {
- FetchSalesOrderHeaderDataTable();
- }
- }
- public static void FetchSalesOrderHeaderDataTable()
- {
- var sw = new Stopwatch();
- sw.Start();
- var headers = new DataTable();
- using(var con = new SqlConnection(ConnectionString))
- {
- var cmd = con.CreateCommand();
- cmd.CommandText = "select * from Sales.SalesOrderHeader";
- var adapter = new SqlDataAdapter(cmd);
- adapter.Fill(headers);
- }
- sw.Stop();
- Console.WriteLine("Fetched {0} rows in datatable from the DB. Took {1}ms", headers.Rows.Count, sw.ElapsedMilliseconds);
- }
- public static void FetchSalesOrderHeaderHandCoded()
- {
- var sw = new Stopwatch();
- sw.Start();
- var headers = new List<SalesOrderHeader>();
- using(var con = new SqlConnection(ConnectionString))
- {
- var cmd = con.CreateCommand();
- cmd.CommandText = "select * from Sales.SalesOrderHeader";
- con.Open();
- var reader = cmd.ExecuteReader();
- while(reader.Read())
- {
- object fieldValue = null;
- var soh = new SalesOrderHeader();
- soh.SalesOrderId = (int)reader.GetValue(0);
- soh.RevisionNumber = (byte)reader.GetValue(1);
- soh.OrderDate = (DateTime)reader.GetValue(2);
- soh.DueDate = (DateTime)reader.GetValue(3);
- fieldValue = reader.GetValue(4);
- soh.ShipDate = (DateTime)(fieldValue == DBNull.Value ? null : fieldValue);
- soh.Status = (byte)reader.GetValue(5);
- soh.OnlineOrderFlag = (bool)reader.GetValue(6);
- soh.SalesOrderNumber = (string)reader.GetValue(7);
- fieldValue = reader.GetValue(8);
- soh.PurchaseOrderNumber = (string)(fieldValue == DBNull.Value ? null : fieldValue);
- fieldValue = reader.GetValue(9);
- soh.AccountNumber = (string)(fieldValue == DBNull.Value ? null : fieldValue);
- soh.CustomerID = (int)reader.GetValue(10);
- soh.ContactID = (int)reader.GetValue(11);
- fieldValue = reader.GetValue(12);
- soh.SalesPersonID = (int?)(fieldValue == DBNull.Value ? null : fieldValue);
- fieldValue = reader.GetValue(13);
- soh.TerritoryID = (int?)(fieldValue == DBNull.Value ? null : fieldValue);
- soh.BillToAddressID = (int)reader.GetValue(14);
- soh.ShipToAddressID = (int)reader.GetValue(15);
- soh.ShipMethodID = (int)reader.GetValue(16);
- fieldValue = reader.GetValue(17);
- soh.CreditCardID = (int?)(fieldValue == DBNull.Value ? null : fieldValue);
- fieldValue = reader.GetValue(18);
- soh.CreditCardApprovalCode = (string)(fieldValue == DBNull.Value ? null : fieldValue);
- fieldValue = reader.GetValue(19);
- soh.CurrencyRateID = (int?)(fieldValue == DBNull.Value?null : fieldValue);
- soh.SubTotal = (decimal)reader.GetValue(20);
- soh.TaxAmt = (decimal)reader.GetValue(21);
- soh.Freight = (decimal)reader.GetValue(22);
- soh.TotalDue = (decimal)reader.GetValue(23);
- fieldValue = reader.GetValue(24);
- soh.Comment = (string)(fieldValue==DBNull.Value ? null : fieldValue);
- soh.Rowguid = (Guid)reader.GetValue(25);
- soh.ModifiedDate = (DateTime)reader.GetValue(26);
- headers.Add(soh);
- }
- reader.Close();
- con.Close();
- }
- sw.Stop();
- Console.WriteLine("Fetched {0} handcoded objects in list from the DB. Took {1}ms", headers.Count, sw.ElapsedMilliseconds);
- }
- public static void FetchSalesOrderHeaderDapper()
- {
- var sw = new Stopwatch();
- sw.Start();
- var headers = new List<SalesOrderHeader>();
- using(var con = new SqlConnection(ConnectionString))
- {
- con.Open();
- headers = con.Query<SalesOrderHeader>("select * from Sales.SalesOrderHeader").ToList();
- con.Close();
- }
- sw.Stop();
- Console.WriteLine("Fetched {0} objects from Dapper in list from the DB. Took {1}ms", headers.Count, sw.ElapsedMilliseconds);
- }
- public static void FetchSalesOrderHeaderEntitiesWithCaching()
- {
- var sw = new Stopwatch();
- sw.Start();
- var qf = new QueryFactory();
- var q = qf.SalesOrderHeader.CacheResultset(5);
- var headers = new EntityCollection<SalesOrderHeaderEntity>();
- using(var adapter = new DataAccessAdapter())
- {
- adapter.FetchQuery(q, headers);
- }
- sw.Stop();
- Console.WriteLine("Fetched {0} LLBLGen Pro v4 entities with resultset caching from the DB. Took {1}ms", headers.Count, sw.ElapsedMilliseconds);
- }
- public static void FetchSalesOrderHeaderEntities()
- {
- var sw = new Stopwatch();
- sw.Start();
- var headers = new EntityCollection<SalesOrderHeaderEntity>();
- using(var adapter = new DataAccessAdapter())
- {
- adapter.FetchEntityCollection(headers, null);
- }
- sw.Stop();
- Console.WriteLine("Fetched {0} LLBLGen Pro v4 entities from the DB. Took {1}ms", headers.Count, sw.ElapsedMilliseconds);
- }
- public static void FetchSalesOrderHeaderEntitiesv35()
- {
- var sw = new Stopwatch();
- sw.Start();
- var headers = new LLBL35.AW.HelperClasses.EntityCollection<LLBL35.AW.EntityClasses.SalesOrderHeaderEntity>();
- using(var adapter = new LLBL35.AW.DatabaseSpecific.DataAccessAdapter())
- {
- adapter.FetchEntityCollection(headers, null);
- }
- sw.Stop();
- Console.WriteLine("Fetched {0} LLBLGen Pro v3.5 entities from the DB. Took {1}ms", headers.Count, sw.ElapsedMilliseconds);
- }
- public static void FetchSalesOrderHeaderEF()
- {
- var sw = new Stopwatch();
- sw.Start();
- List<EF.Bencher.EntityClasses.SalesOrderHeader> headers = null;
- using(var ctx = new EFBencherDataContext())
- {
- headers = ctx.SalesOrderHeaders.ToList();
- }
- sw.Stop();
- Console.WriteLine("Fetched {0} entity framework v5 entities from the DB. Took {1}ms", headers.Count, sw.ElapsedMilliseconds);
- }
- public static void FetchSalesOrderHeaderL2S()
- {
- var sw = new Stopwatch();
- sw.Start();
- List<L2S.Bencher.EntityClasses.SalesOrderHeader> headers = null;
- var ctx = new L2SBencherDataContext();
- headers = ctx.SalesOrderHeaders.ToList();
- sw.Stop();
- Console.WriteLine("Fetched {0} Linq to Sql entities from the DB. Took {1}ms", headers.Count, sw.ElapsedMilliseconds);
- }
- public static void FetchSalesOrderHeaderNH()
- {
- var sw = new Stopwatch();
- sw.Start();
- List<NH.Bencher.EntityClasses.SalesOrderHeader> headers = null;
- using(var session = SessionManager.OpenSession())
- {
- headers = session.Query<NH.Bencher.EntityClasses.SalesOrderHeader>().ToList();
- }
- sw.Stop();
- Console.WriteLine("Fetched {0} NHibernate v3.3.1.4 entities from the DB. Took {1}ms", headers.Count, sw.ElapsedMilliseconds);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement