Benchmarking data insertion methods
In this section, we will be following on from the work we did in Chapter 10, Setting Up Our Database Project, by writing methods that will benchmark the performance of insert methods using ADO.NET, Entity Framework Core, and Dapper.NET. So, if you have not read Chapter 10, or looked at the source code, now would be a good time to do that.
The benchmarks written in this chapter will be run and the results will be analyzed in the last section. To save space due to chapter and page constraints, I will be leaving out references to using
statements. Therefore, you will need to use Visual Studio's quick tips for adding missing using
statements. Follow these steps to write our insertion method benchmarks:
- Add the
BenchmarkDotNet
NuGet package. - Open the
BenchmarkTests
class and modify it as follows:[MemoryDiagnoser] [Orderer(SummaryOrderPolicy.Declared)] [RankColumn] public class BenchmarkTests { [GlobalSetup]...