/// <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());
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Run multithreaded operations.
        /// </summary>
        /// <param name="worker">The worker to use.</param>
        private static void StressThread(PerfTestWorker worker)
        {
            const int NumRecords   = 50000;
            const int NumRetrieves = 100;

            worker.InsertRecordsWithAddFunction(NumRecords);
            worker.RepeatedlyRetrieveOneRecord(NumRetrieves);
            worker.RepeatedlyRetrieveOneRecordWithTryGetValue(NumRetrieves);
            worker.RepeatedlyRetrieveOneRecordWithBracketOperator(NumRetrieves);
            worker.RetrieveAllRecords();

            worker.InsertRecordsWithBracketOperator(NumRecords);
            worker.RepeatedlyRetrieveOneRecord(NumRetrieves);
            worker.RepeatedlyRetrieveOneRecordWithTryGetValue(NumRetrieves);
            worker.RepeatedlyRetrieveOneRecordWithBracketOperator(NumRetrieves);
            worker.RetrieveAllRecords();
        }
Esempio n. 4
0
        /// <summary>
        /// Insert some integer records and then retrieve them.
        /// </summary>
        private void InsertReadSeekLongs()
        {
            const int NumRecords = 100 * 1000;

            long[] keys = this.GetRandomKeys(NumRecords);

            using (var worker = new PerfTestWorker(
                       this.longDictionary,
                       this.longDatabase,
                       this.stringDictionary,
                       this.stringDatabase))
            {
                TimeAction("Insert records with Add()s", () => worker.InsertRecordsWithAddFunction(NumRecords / 2));
                TimeAction("Insert records with []", () => 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 sequentially", worker.RetrieveAllRecords);
                TimeAction("Seek to all records randomly", () => worker.SeekToAllRecords(keys));
            }
        }