With the Entity Framework Core 2.0 more performative, I resolved to make a performance test. I want to see if the new version got better
.NET Core 2.0 is in production now with many things improved in relation to the .NET Core 1.X. One such improved thing is Entity Framework Core. Thinking about that, I resolve to make a benchmark to see its performance.
Those who do not know the Dapper, I recommend seeing this project. It is a little ORM, It does not do all that the Entity Framework and NHibernate do, but its query is very fast. In the last years is common to see a project with an ORM and the Dapper to optimize the query.
Coming back to benchmark, I did something silly, I created the product and category entities, being that a product has a category.
An observation, I am not a specialist in benchmark or measure code performance, but I liked this package to see the performance. And that is why I am using a package called benchmarkdotnet
The idea is simple, comparing the insertion, query and query with filter. Of course, that that I make comparing Entity Framework Core 2.0 with Dapper.
Below you see the finish result.
The explication of each method,
- EfInsert e DapperInsert: EfInsert is used by EF and DapperInsert is used by Dapper. The methods insert the data.
- EfSelect e DapperSelect: EfSelect is used by EF and DapperSelect is used by Dapper. The methods query in the database all entities.
- EfSeletWithFilter and DapperSelectWithFilter: EfSelectWithFilter is uded by EF and DapperSelectWithFilter is used by Dapper. The methods query in the database all products where the category name is “Games”.
Note that in all demonstration the Entity Framework Core 2.0 won. This is good, show that the Microsoft team is really fulfilling with what said about bringing a .Net Core with high performance.
Whose that still has doubt in relation to use or not the Entity Framework Core 2.0, I believe that now it is a strong option, starting by performance. I created a course that approaching the Entity Framework Core 2.0, following the link.
If you would like to analyze my benchmark and give me feedback, following the link.
Ok Guys, I hope to help you and good week.