Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Framework 5.0 Benchmark Test

I'm doing an internship, and I've been asked to evaluate the performance changes for the new Entity Framework 5.0. I've personally never used the Entity Framework, nor do I have any kind of big database or queries to do a proper benchmark test.

I've been doing some simple tests targeting to .NET 4.5 using for loops of LINQ queries in order to try getting the Query automatically compiled and see some kind of performance change from when I target to .NET 4.0, but I've not been able to see any kind of performance change at all.

Is there any kind of already done benchmark test for Entity Framework which could show when the new version of Entity Framework has a better performance?

Thanks

like image 532
ShikiGami Avatar asked Aug 24 '12 04:08

ShikiGami


1 Answers

Few things:

  • If you want to compare performance changes between .NET 4 and .NET 4.5 you must have two machines for that because .NET 4.5 is in-place upgrade. Installing .NET 4.5 on machine will "remove" possibility to run on old .NET 4.0 (thank Microsoft for this nightmare). You can target project to .NET 4 but at runtime you will always run on .NET 4.5 if it is installed.
  • Finding performance improvements can be quite difficult because there is no list of real changes in query generation but two areas which should interest you are:
    • Auto compiled queries - automatic feature in EF5 with .NET 4.5. This feature should improve subsequent execution speed of queries - first execution will be still "slow" or perhaps even "slower" than in .NET 4
    • Optimizations in Table-per-hierarchy queries. This should generally improve queries targeting just single type in inheritance structure or projecting just fields from base entity. In .NET 4 this always led to joining all tables for derived entities even if they were not needed. I didn't try this improvement yet so I will be happy to read your findings here.
like image 152
Ladislav Mrnka Avatar answered Nov 10 '22 18:11

Ladislav Mrnka