Skip to content

Commit 3f098cc

Browse files
committed
Decrease testcase sizes in cuckoocache tests
1 parent 5114f81 commit 3f098cc

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/test/cuckoocache_tests.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ BOOST_AUTO_TEST_CASE(test_cuckoocache_no_fakes)
6060
{
6161
insecure_rand = FastRandomContext(true);
6262
CuckooCache::cache<uint256, uint256Hasher> cc{};
63-
cc.setup_bytes(32 << 20);
63+
size_t megabytes = 4;
64+
cc.setup_bytes(megabytes << 20);
6465
uint256 v;
6566
for (int x = 0; x < 100000; ++x) {
6667
insecure_GetRandHash(v);
@@ -135,7 +136,7 @@ BOOST_AUTO_TEST_CASE(cuckoocache_hit_rate_ok)
135136
* as a lower bound on performance.
136137
*/
137138
double HitRateThresh = 0.98;
138-
size_t megabytes = 32;
139+
size_t megabytes = 4;
139140
for (double load = 0.1; load < 2; load *= 2) {
140141
double hits = test_cache<CuckooCache::cache<uint256, uint256Hasher>>(megabytes, load);
141142
BOOST_CHECK(normalize_hit_rate(hits, load) > HitRateThresh);
@@ -204,7 +205,7 @@ void test_cache_erase(size_t megabytes)
204205

205206
BOOST_AUTO_TEST_CASE(cuckoocache_erase_ok)
206207
{
207-
size_t megabytes = 32;
208+
size_t megabytes = 4;
208209
test_cache_erase<CuckooCache::cache<uint256, uint256Hasher>>(megabytes);
209210
}
210211

@@ -291,7 +292,7 @@ void test_cache_erase_parallel(size_t megabytes)
291292
}
292293
BOOST_AUTO_TEST_CASE(cuckoocache_erase_parallel_ok)
293294
{
294-
size_t megabytes = 32;
295+
size_t megabytes = 4;
295296
test_cache_erase_parallel<CuckooCache::cache<uint256, uint256Hasher>>(megabytes);
296297
}
297298

@@ -342,13 +343,13 @@ void test_cache_generations()
342343
}
343344
};
344345

345-
const uint32_t BLOCK_SIZE = 10000;
346+
const uint32_t BLOCK_SIZE = 1000;
346347
// We expect window size 60 to perform reasonably given that each epoch
347348
// stores 45% of the cache size (~472k).
348349
const uint32_t WINDOW_SIZE = 60;
349350
const uint32_t POP_AMOUNT = (BLOCK_SIZE / WINDOW_SIZE) / 2;
350351
const double load = 10;
351-
const size_t megabytes = 32;
352+
const size_t megabytes = 4;
352353
const size_t bytes = megabytes * (1 << 20);
353354
const uint32_t n_insert = static_cast<uint32_t>(load * (bytes / sizeof(uint256)));
354355

0 commit comments

Comments
 (0)