Performance analyze ADO.NET and Entity Framework

ado.net c# entity-framework performance

Accepted Answer

ZZZ_tmp
58
2/27/2013 9:30:44 AM

Popular Answer

  • 1) When using databases, EF greater comforts a lot of stuff. There is a lot going on behind the scenes that you would otherwise have to code by hand.

One of my first larger projects, for instance, involved a lot of data, and I used ADO.NET to construct the access layer. This made up anywhere from a quarter to a third of the entire project.

I could get rid of almost all of that because to my experience with the EF today! Just a lot of the intricate code I manually built is now absolutely unnecessary. Thousands of lines are involved here.

  • 2) This has two basic causes. The foundation upon which EF is constructed is ADO.NET. In other words, anything EF does increases the overhead of everything ADO would perform. Second, the JIT compiler compiles the code for the first time right before it is executed, to put it very simply. This comprises initializations of all kinds including memory allocation.

This implies that after the second time, code is executed significantly more quickly. However, you won't benefit from such initializations if you simply run your EF queries once.

You might attempt to make some improvements in a real-world application, such as by utilizing Collected Questions. This will greatly improve your performance because your queries will only need to be prepared and compiled once rather than every time you run them.



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow