Speed Test for Entity Framework (EF) Bulk Insert ( EF AddRabge VS EF Utility VS EF Extension)

Bulk Insert Speed Test

In this post, we will discuss the bulk insert using Entity Framework (EF) in ASP.Net.

we are going to compare three approaches using Entity Framework: EF AddRange(), EF Utility (https://github.com/MikaelEliasson/EntityFramework.Utilities) and EF Extension from http://entityframework-extensions.net/.

Since EF Extension is not open source and owned by a company, I just show my result using its trial version and don’t want to make any troubles with that company. Maybe I made some mistakes in my coding or setting, you may using its trail version code to test by yourself.

My Device and Software Information

Processor: i7-6800k 3.4GHz

RAM: 32.0 GB, 2133MHz

Disk:  SSD 850 PRO 256GB

Motherboard: 99A GAMING PRO CARBON

IDE:  Microsoft Visual Studio Community 2017 Version 15.1

SQL Server: SQL Server 2016

System: Window 10

The Test Result

From this result, we can see the original EF AddRange takes the longest time to insert data, while EF Utility takes the best records, using only 3619 ms. To my surprise, the EF extension takes much longer time than the open source EF Utility. I suppose to believe EF Extension will be the best since it asks for payment using its tools.

Test Detail

You can check my code in my Github repository at https://github.com/Lukas1882/ASP.Net_Database_Insert_Speed_Test. Since the EF extension is not open source, I have deleted the all the related source file related to it. To test it in your local, please install the trial version and user the test code which in my Git Log. EF Extension is very easy to use, you won’t miss it.

Insert the Data ( C# Code )

Our SQL Test Data

For the data in the SQL Server, this is the SQL Script to create 2 tables, one is the source table, one is the target table.

In the source and target tables, I set one primary key and 3 indexed columns for each of them.  I use this SQL Script to insert 10,000 rows random data.

After inserting the data, we get a table with 76 MB in size. Now, we have our fake big source table.

This is the screenshot of the records.

1 comments On Speed Test for Entity Framework (EF) Bulk Insert ( EF AddRabge VS EF Utility VS EF Extension)

Leave a reply:

Your email address will not be published.

Site Footer