BulkSaveChanges is already very fast. But you can make it even faster by simply turning off the “EntityFrameworkPropagation” options.
While the performance will be significantly increased, this option works with 99,9% of models. Unfortunately, we cannot turn this option on by default for backward compatibility until we make it work with all models
We are currently working on the next major version which will have even better performances!
|Operations||1,000 Entities||2,000 Entities||5,000 Entities|
|SaveChanges||1,000 ms||2,000 ms||5,000 ms|
|BulkSaveChanges()||90 ms||150 ms||350 ms|
|BulkSaveChanges(false)||60 ms||70 ms||140 ms|
For SQL Server, performance improvement is around 2x faster.
For some provider like SQLite, performance improvement can be as high as 10x faster.
These limitations will be fixed in the next major version.
Unfortunately, Entity Framework is very slow at generating commands to be executed. For some providers, it takes more time to generate these queries than executing them!
When turning off, the library does no longer use the methods from Entity Framework but internal methods from our library.