/// <summary> /// Run multithreaded operations. /// </summary> /// <param name="worker">The worker to use.</param> private static void StressThread(PerfTestWorker worker) { int numRecords = 5000 * worker.RandomGenerator.Next(0, 10); int numRetrieves = 50 + worker.RandomGenerator.Next(0, 100); worker.InsertRecordsWithAddFunction(numRecords); worker.CloseReopenDictionary(); worker.RepeatedlyRetrieveOneRecord(numRetrieves); worker.CloseReopenDictionary(); worker.RepeatedlyRetrieveOneRecordWithTryGetValue(numRetrieves); worker.CloseReopenDictionary(); worker.RepeatedlyRetrieveOneRecordWithBracketOperator(numRetrieves); worker.CloseReopenDictionary(); worker.RetrieveAllRecords(); worker.CloseReopenDictionary(); worker.CloseReopenDictionary(); worker.InsertRecordsWithBracketOperator(numRecords); worker.CloseReopenDictionary(); worker.RepeatedlyRetrieveOneRecord(numRetrieves); worker.CloseReopenDictionary(); worker.RepeatedlyRetrieveOneRecordWithTryGetValue(numRetrieves); worker.CloseReopenDictionary(); worker.RepeatedlyRetrieveOneRecordWithBracketOperator(numRetrieves); worker.CloseReopenDictionary(); worker.RetrieveAllRecords(); }
/// <summary> /// Insert some records and then retrieve them. /// </summary> private void InsertReadSeek() { const int NumRecords = 100 * 1000; using (var worker = new PerfTestWorker()) { TimeAction("Insert records", () => worker.InsertRecordsWithAddFunction(NumRecords / 2)); TimeAction("Insert records with SetColumn", () => worker.InsertRecordsWithBracketOperator(NumRecords / 2)); TimeAction("Read one record", () => worker.RepeatedlyRetrieveOneRecord(NumRecords)); TimeAction("Read one record with JetRetrieveColumns", () => worker.RepeatedlyRetrieveOneRecordWithTryGetValue(NumRecords)); TimeAction("Read one record with RetrieveColumns", () => worker.RepeatedlyRetrieveOneRecordWithBracketOperator(NumRecords)); TimeAction("Read all records", worker.RetrieveAllRecords); TimeAction("Close/Reopen", () => worker.CloseReopenDictionary()); } }