private static void Setup() { stopwatch = new Stopwatch(); // Prime the SQL connection pool, and preload assemblies. // We want these factors excluded from our calculations. var items = GenerateItems(1); BulkCopyService.Insert(items); XmlInsertService.Insert(items); StandardInsertService.Insert(items); }
private static void Perform(int numItems, int numPasses) { var items = GenerateItems(numItems); // Time bulk copy Time(() => { for (int x = 0; x < numPasses; x++) { BulkCopyService.Insert(items); } }); Log("BCP", numItems, numPasses); // Time XML insert Time(() => { for (int x = 0; x < numPasses; x++) { XmlInsertService.Insert(items); } }); Log("XML", numItems, numPasses); // Time standard inserts Time(() => { for (int x = 0; x < numPasses; x++) { StandardInsertService.Insert(items); } }); Log("STD", numItems, numPasses); Console.WriteLine(); }