Which one may have the best performance - LINQ to EF or NHibernate?

I want to start work on a large project. I am exploring LINQ performance issues for EF and NHibernate. I want to use one of them as an ORM in my project. Now my question is, can one of these two ORMs improve the performance of my project? I will use SQL Server 2008 as a database and C # as a programming language.

+4
source share
3 answers

None of them will have "better performance."

When analyzing performance, you need to look at the limiting factor. The limiting factor in this case is not the ORM that you choose, but rather how you use this tool, how you write your queries and how to optimize the database backend.

Thus, the β€œfastest” ORM will be the one you can use correctly in combination with the database server that you understand best.

ORM itself has a certain amount of overhead, so the "fastest", in terms of pure performance, should not be used at all. However, this contributes to computer time during development, which is usually not a good compromise. ORMs can save a lot of development time while imposing only a small overhead when used properly.

Usually, when people experience performance problems when using ORMs, this is because they are using ORMs incorrectly, and not because they have chosen the β€œwrong” ORMs.

+4
source

We currently use Fluent NHibernate in our projects (with web services, which adds extra time), and as far as I can see, access to data is pretty much instant (from a human point of view).

Maybe someone can answer with specific numbers, though.

Since the two ORMs are slightly different from each other, it would be better to decide which one should be used in relation to your specific needs, rather than performance (which, as I said, should not be a big deal).

+3
source

Here is a good test . As you can see, the results depend on whether you are performing SELECT , UPDATE , DELETE .

+1
source

Source: https://habr.com/ru/post/1306773/


All Articles