I stumbled across a SO post about performance, where the main hindrance was Entity Framwork/DB operations.
Here's a summary of the suggested approaches for performance improvement:
- Using Dapper or raw ADO.NET components.
- Disabling EF change auto detection and validation on save flags.
- Using BulkInsert
- Instead of adding new entities inside a loop, collect all the entity objects to be added into a collection - and one you are finished issue a single [entity].AddRange(collection) to push all the new entities into the EF object (and afterwards performing a SaveChanges). It is stated that this is performance-wiser.
Some performance comparison tests for the above can be found in the web, here is a nicely presented one.
See also Performance considerations for EF 4, 5 and 6.
No comments:
Post a Comment