+ // Run GC after "kGCFrequency" operations.
+ const size_t kGCFrequency = 1500;
+ const size_t kMapSize = 20000;
+
+ enum actions { do_find, do_insert, do_delete };
+ static const unsigned int kShuffleSize = 100;
+ static actions s_arrShuffle[kShuffleSize];
+
+ const size_t kCrudePassCount = 400000;
+ const size_t kGrampaPassCount = 60000;
+ const size_t kLinearPassCount = 70000;
+ const size_t kLeapfrogPassCount = 75000;
+
+ static void SetUpTestCase() {
+ // Build an array of shuffled actions.
+ EXPECT_LE(s_nInsertPercentage + s_nDeletePercentage, 100);
+ actions* pFirst = s_arrShuffle;
+ actions* pLast = s_arrShuffle + s_nInsertPercentage;
+ std::fill(pFirst, pLast, do_insert);
+ pFirst = pLast;
+ pLast += s_nDeletePercentage;
+ std::fill(pFirst, pLast, do_delete);
+ pFirst = pLast;
+ pLast = s_arrShuffle + sizeof(s_arrShuffle) / sizeof(s_arrShuffle[0]);
+ if (pFirst < pLast) {
+ std::fill(pFirst, pLast, do_find);
+ }
+ std::random_device rd;
+ std::mt19937 g(rd());
+ std::shuffle(s_arrShuffle, pLast, g);
+ }