Entity Framework Performance Comparison

Caveat emptor: These numbers are merely indicative. The “shape” of your data, your indexing, your SQL Server setup, etc. are big differentiating factors. Your mileage may vary. Do not sue me if you make any architectural decisions based on these figures and discover some fundamental flaw one year down the road, a few days before live cut-over.

The dataset: 100,000 records in the main table; each record is linked to assorted records in 3 other tables. The query: select 20 out of these 100,000 records based on certain criteria. The 20 objects to be loaded has 3 child objects and lots of string properties.

The DB server is a VM and the app server is a dev box. The test program is a console application which calls a GetItems(criteria, pageNumber, pageSize) method contained in a DLL.

Performance measurement tool: perfmon.exe where performance object = Process, counter = Private Bytes and % Processor Time, instance = <console app exe>.

Avg. execution time (ms) Avg. memory (MB) Avg. % processor time
EF out of the box 3,189.11 51 15
EF with stored procedures (function imports) 2,283.19 46 13
EF using compiled queries 632.64 48 28
EF using Entity SQL 892.16 54 45
DataReader with inline SQL, manual ORM 828.43 27 18

10 March 2010 | .NET | Comments

Comments:

  1.  
  2.  
  3.