EF vs NHibernate vs Drapper ORM

entity-framework nhibernate orm


I am trying to understand which ORM is fast in performance?

  • NHibernate support Level 2 caching can we compare its performance with EF or Drapper?
  • EF Code First looks promising, but do we have inbuilt Level 2 cache support for EF?
  • Don't know much about Drapper ORM

Can someone please explains me pros and cons of this ORM and which one to choose for application performance boost.

9/12/2012 2:12:35 AM

Accepted Answer

The problem with "big" ORM tools such as EF or NHibernate, is that (exagerating?) 99% of developers are overwhelmed with mastering simply how to make it work; they don't have time to figure out how to make it perform. Worse, making these tools perform properly usually boils down to having competent SQL/Database design and tuning skills - which weakens a major selling point of the ORM.

The issue with Level 2 caching, in my opinion, is eclipsed by the other performance losses a poorly-used ORM introduces. It seems most projects using an ORM are doing a poor job of it (along with a poor job of designing the database), which makes level 2 caching somewhat moot.

As a consequence, micro-ORM tools like Massive or Dapper (the latter is used by Stack Overflow) are very attractive:

  • Unlike a macro ORM, developers don't spend months learning how to use them. Each micro-ORM is less than a thousand lines of code (criminy!). How long could that possibly take to understand?
  • The extra time developers have on their hands can be dedicated to gaining more mastery of SQL, which they will need to learn for a performant use of a macro or micro ORM.

To be clear, a well-used macro ORM is a great thing. Do you have the highly experienced staff to ensure that it is well-used?

The bottom line is this: if you think a full-scale ORM will safely hide database complexity, almost assuredly you'll be mistaken. If I'm given a choice I would go with a micro ORM. Don't get me wrong, I think EF and NHIbernate are very cool and I'm jazzed to use them - I'm just saying you need to manage your expectations.

9/15/2012 11:22:03 PM

Related Questions


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