Tuesday, March 8, 2016

Is Entity Framework the best performing option for PostgreSQL and .NET applications?

Updated on Monday, April 15, 2017
Abstract
Object-relational mapping (ORM) solutions provide a virtual layer between actual application code and backend database (DB) being used in an application via create, read, update and delete (CRUD) operations. PostgreSQL has been one of the top notch backend DB being deployed with Microsoft .NET applications worldwide. This experiment will be targeting various ORM solutions which may perform well with Microsoft .NET platform and PostgreSQL as backend. The list of ORM solutions that will be evaluated includes NHibernate (NH), OrmLite, MicroLite, Entity Framework (EF), LINQ to PostgreSQL, I-Nercya EntityLite Core, Symbiotic Micro ORM x64, LLBLGen Pro, Uni.ORM, and FluentData. It’s very much true that one may be easy to setup and consume than the other, but scope of this experiment will be limited to analyzing these ORM solutions based on how fast they are able to perform CRUD operations with PostgreSQL and .NET.
-1. know your test system
https://hemantrohtak.blogspot.com/2017/02/startstopget-details-for-windows.html
0. Create test databases
https://hemantrohtak.blogspot.com/2017/03/create-database-and-content-using-psql.html
1. EntityFramework6.exe
https://hemantrohtak.blogspot.com/2017/02/entityframework6npgsql-with-postgresql.html
2. FluentData3.exe
https://hemantrohtak.blogspot.com/2017/02/fluentdata-with-postgresql-and-net.html
3. InercyaEntityLite1121.exe
https://hemantrohtak.blogspot.com/2017/02/i-nercya-entitylite-with-postgresql-and.html
4. LINQtoPostgreSQL17x.exe
https://hemantrohtak.blogspot.com/2017/02/linq-to-postgresql-with-postgresql-and.html
5. LLBLGenProLite51Console.exe
https://hemantrohtak.blogspot.com/2017/02/llblgenpro-lite-with-postgresql-and-net.html
6. MicroLite6.exe
https://hemantrohtak.blogspot.com/2017/02/microlite-with-postgresql-and-net.html
7. NHibernate4.exe
https://hemantrohtak.blogspot.com/2017/02/nhibernate-with-postgresql-and-net.html
8. OrmLite.exe
https://hemantrohtak.blogspot.com/2017/02/ormlite-with-postgresql-and-net.html
9. SymbioticDataProviderPostgreSql2.exe
https://hemantrohtak.blogspot.com/2017/02/symbioticdataproviderpostgresqlx64-with.html
10. UniORM144.exe
https://hemantrohtak.blogspot.com/2017/02/uniorm-with-postgresql-and-net.html

git clone https://bitbucket.org/hemantup/orm.git -b master

test Run output: (Average calculated from 10 Cycles)
bitbucket.org/hemantup/orm/raw/HEAD/Results/

As pdf:

https://drive.google.com/open?id=0B6dqipWMkn9XemNaWFRBdkU5b1E





4 comments:

  1. one more contender - http://vita.codeplex.com. Supports Postgres, full LINQ, and will certainly beat EF and NH in performance - especially update/insert - it has batch mode, executing all changes in one roundtrip

    ReplyDelete
  2. Hi, you mentioned that "PostgreSQL has been one of the top notch backend DB being deployed with Microsoft .NET applications worldwide." Do you have any examples of companies or projects using this tech stack?

    ReplyDelete
    Replies
    1. Please refer to no of downloads on NuGet for related stuff. e.g, as of 11/6/15 , no of downloads for nuget packages realte to this combination:

      ORM Downloads
      1 NHibernate 4.0.4.4000 1,022,019
      2 OrmLite.PostgreSQL - Fast, code-first, config-free Poco ORM 4.0.46 24793
      3 DotConnect Express for PostgreSQL 7.4.521 16169
      4 MicroLite 6.2.6 7058
      5 Npgsql for Entity Framework 6 3.0.3 4,155
      6 LINQ to PostgreSQL 1.0.7.3, 3615
      7 i-nercya EntityLite Core 1.12.1 2,206
      8 Symbiotic Micro ORM x64 4.0.3 1,783
      9 LLBLGen Pro Dynamic SQL Query Engine for PostgreSql 4.2.20151023 682
      10 Uni.ORM 1.3.7 627
      11 Dapper.Rainbow.PostgreSql 0.7.1 510
      12 Tiraggo Architecture for PostgreSQL 2014.1.419.3 447
      13 Prius ORM for people who like stored procedures 1.0.6 342
      14 FluentDAO 3.1.0 183



      Neverthless, purpose of this article is not to convince you: go and use PostGreSQL with .Net,but one step further : if you choose this combination then what ORM to choose of the two most popular.

      Thanks

      Delete
  3. Hello, I'm the creator of EntityLite. I'm been looking at the benchmark code and I have seen it is not fair. Create, update and delete benchmarks use transactions on all orm's but EntityLite. You should start a transaction by calling ds.BeginTransaction before starting the loop that creates, updates or delete rows, and call ds.Commit after the loop

    ReplyDelete