views:

6592

answers:

20

I'm curious if anyone has done any performance comparisons with any or all of the main players in the .NET ORM space. Specifically I'm interested in comparisons between the following:

  • Linq to SQL
  • NHibernate
  • LLBL Gen
  • Entity Framework

Though it seems people don't really consider Linq to SQL a true ORM, I am still including it in this list. Some performance metrics would be nice to see.

+10  A: 

It really depends on how complex your application will be: for rather simple datastructure I would recommend LINQ2SQL. If it's getting more complex, try to consider NHibernate or other Products on an advanced Level (like Genome). From the performance point of view, nowadays this ORM-Mappers are quite the same.

MADMap
I agree with the main point, but disagree with your view on performance: it is quite different from ORM to ORM. You consider they're similar because likely you measure the performance of RDBMS instead of ORM itself.
Alex Yakunin
+6  A: 

LLBL Gen cut my development time for projects by 25%. Very simple to use and exceptionally good customer support.

William
+1  A: 

I've had spectacular results using NHibernate, and even the NHibernate.Linq NContrib implementation. I touched on this a bit on my last blog post. I've also used DBLinq which was not implemented well at all for Oracle.

To that note, the answer lies also in which database platform you are using, and if you need to be multi-DB capable. I would think for pure SQL Server stuff, you are best off sticking with LINQ to SQL and possibly the Entity Framework once it matures another version.

TheSoftwareJedi
+1  A: 

I have listed over 8 other ORM solutions that are not so popular.

http://stackoverflow.com/questions/380620/what-object-mapper-solution-would-you-recommend-for-net#380726

amazedsaint
+2  A: 

The performance numbers for these orm mappers is basically only dependent on the sql they create and this is again very dependent on how you set them up. Some of these mappers are of course more customizable than others so then it is even more up to you to configure them correctly.

If you have a good database then the difference probably won't be big, but if you have a more exotic database then you probably are better of with a more configurable mapper.

I have experience from Linq2sql and it is quick to set up and generates mostly very good sql, but if you have a more complex database you can take a look at NHibernate or Entity Framework which are more configurable. LLBL Gen and Subsonic are 2 other well known mappers but I am not familiar with those. Other more unknown mappers exists also.

TT
+3  A: 

Definitely missing here is Telerik OpenAccess (formerly Vanatec OpenAccess), which allows you to optimize performance on business object level by defining FetchPlans which generates optimized SQL. And that's the most important thing with respect to ORM performance.

+1  A: 

All of the solutions that you list provide data access with acceptable performance for an enterprise application.

If performance is a major consideration, be aware that Entity Framework is faster, typically about twice as fast:-

http://www.timacheson.com/Blog/2009/jun/entity_framework_vs_subsonic

EF is also fully integrated with Visual Studio and offers a more complete, more advanced set of features if needed.

Tim
+6  A: 

Try DataObjects .NET 4.0. It's fast, easy to use and powerful framework. Uses "Code-First" approach and mapping through attributes. Rather comprehensive support of LINQ.

  • Performance
  • DB Schema generation and upgrade
  • Inheritance support (3 modes)
  • Paired properties
  • etc.

It has a lot of samples and online documentation. Cuyrrently it has providers for MS SqlServer 2005+, PostgreSql 8.1+. Provider for Oracle will be completed in August.

Alexis Kochetov
Maybe it would be fair to point out, that you're one of the developers of DataObjects.NET.
M4N
A: 

I shifted from "Linq to SQL" to OpenAccess from Telerik and I have no regrets. It's just as simple - if you want it to be. But you have more control regarding caching, fetchplans optimized SQL. You can map both ways, from tables to classes and classes to tables and it supports many different types of databases. You can define and use several databases and so on. I am confident that, in time, it will be an "EFOS" system (Entity Framework On Steroids). You can read more about on telerik.com and check out the forums when you are there.

Thanks, hessner. I already use telerik's products extensively, and have a healthy respect for their quality.
steve_c
+7  A: 

We just launched new web project ORMBattle.NET and published there result of our CRUD and benchmarks. One can see results and inspect source code of all our tests. We also plan to publish some analytic articles on related topics.

Alex Kofman
The problem is that the “bench marks” on ORMBattle are not very “real life” and were created by one ORM vender to show his ORM in good light.
Ian Ringrose
See "Post scriptum" here: http://ormbattle.net/index.php/faqs/78-what-kind-of-orm-tool-can-win-in-this-benchmark.html
Alex Yakunin
A: 

Just to add to list: EntityORM

A recent ORM that have common features found in other ORMs and a not common features like synchronizer mechanism to synchronize the entity structures to the database tables; automatic mark changed for optimized udpdates; automatic lazy loading; automatic transactions; rules valition; two-way direction support in all kind of relations; ...

+1  A: 

If performance is the most important than you could check out this site http://ormbattle.net

For me after a performance test there is also the product cost and learning curve but there is also the features.

If a product have less features than should be faster but you will see soon or later that you will be tied and you have to take a hammer to overcome limitations.

For me a good ORM give not only the CRUD operations but in a easy way all the features to do the data layer work without have to workaround and still have a good performance.

+2  A: 

I little aside for anyone who's interrested... I've spent the day today looking for an alternative to Linq-To-SQL (I was hoping for an alternative that would either offer caching, or be open-source).

I didn't investigate ActiveRecord simply by the fact that according to independant serveys it does not perform as fast as many other ORMs and it does not have a full Linq implementation.

DataObjects.NET requires that all your entities be derived from special classes, but in exchange for this you respectable performance and goodies like in-memory storage providers and the most complete Linq implementation going.

I spend the afternoon sifting through the source code of DBLinq. My opinion is that it is immature (many of Linq-To-SQL's features are simply not implemented), and I wouldn't recommend it for production systems.

So then... if you're looking for a free, fast, open source, LINQ compliant ORM then DataObjects.NET is a pretty safe bet.

Mark
A: 

We use for the most of our projects DevExpress XPO. It gives us the most important features we need:

  • From Classes (via Attributes) to DB-Schema OR from DB-Schema to Classes

  • No blown-up designers (in fact you can completely do it just from the code-side)

  • UnitOfWork-Pattern

  • Very flexible. For example you can use mass-reads through views and later instantiate objects etc. etc.

  • Linq support

  • Superb support

  • ...

Regards.

michael
+2  A: 

Checkout XmlDataMapper a simple free ORM (LGPL Licence) which leaves a low memory footprint compared to the other giants. The sample project provided should be good enough to get started.

To integrate XmlDataMapper all you need to do is 4 little steps

  1. Create a Business Entity / DTO for the tables
  2. Create an XML File with the mapping information between the table and the DTO.
  3. Specify the DTO and xml file in the configuration.
  4. Just call the DTOConverter.Convert(dataReader) and other such methods to convert your database record to DTO / Business Entity
Binoj Antony
A: 

I have developed my own ORM C# code generator named FrameworkGen it doesn't offer as much as the bigs boys but it is performant and the code that is generated is simple but effective.

It might not be suitable for every application but I think it is a good alternative if reflection and other DAL overheads are a concern and its Free.

Performance comparisons are availble on the FrameworkGen website (www.elencysolutions.co.uk)

CroweMan
+1  A: 

Check out link text

They have a definitive list of test comparisons with all products. DataObjects.Net is a clear leader in the LINQ compatibility (which is of huge importance for myself) and don't fair too badly in the performance tests either.

I'm currently using the information on this site to prioritise my ORM evaluations as there is pressure to move away from the now unsupported LINQ2SQL.

paul
A: 

There are many factors to ORM performance. The database structure and indexing can play with or against a particular ORMs data retrieval strategies.

Simple one table queries won't vary too much by the ORM used but when you get into complicated multi-entity fetches with complicated prefetch paths, the stategy the orm uses can cause wildly varying performance. Does it try to fill multiple types of entities with one query and then eliminate duplicate data for root entities as it reads the datareader or does it perform multiple queries each tuned for the specific entity being retrieved then merge and build the entity graph from those individual data streams. Does it retrieve deep branches of the tree based on the predicates used for the top entities or does it use it's knowledge of intermediate level primary keys to optimize the predicates used at deeper levels.

It's a complicated subject, without one right answer. For my money, LLBlGen is quite smart about it's retrieval strategies and is right up there at the top. But even it could do a better job of optimizing it's retrieval strategy in complicated situations.

automatic
A: 

Here is the fastest: http://valueinjecter.codeplex.com/wikipage?title=Data%20access%20layer%20%28ORM%29%20with%20the%20Value%20Injecter&referringTitle=Home cuz it'not really an ORM but it does the same

Omu
+1  A: 

ORMBattle is a trusted resource. They produce DataObjects.NET framework but it isn't number one solution in ORMBattle list. The last results of scoring were updated in August 2010. There are top ORM solutions by productivity:

So if you need a high productivity - use this rating.

JackD