From ffcf5bb152489bff4263ca17c07a5640af871a29 Mon Sep 17 00:00:00 2001 From: Tyge Løvset <60263450+tylo-work@users.noreply.github.com> Date: Tue, 17 Mar 2020 12:45:08 +0100 Subject: Add files via upload --- benchmark.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'benchmark.cpp') diff --git a/benchmark.cpp b/benchmark.cpp index 9ecbe4b6..b4dc348e 100644 --- a/benchmark.cpp +++ b/benchmark.cpp @@ -8,7 +8,7 @@ declare_CMap(ii, int64_t, int64_t); declare_CVector_string(s); -#define RAND() rand() * rand() +#define RAND() rand() // * rand() int main() { @@ -20,6 +20,7 @@ int main() printf("Starting %llu\n", N); cmap_ii_clear(&map); + cmap_ii_setMaxLoadFactor(&map, 0.77); srand(seed); before = clock(); checksum = inserted = erased = get = 0; @@ -29,7 +30,7 @@ int main() switch (op) { case 1: ++inserted; - checksum += ++cmap_ii_put(&map, rnd, i-1)->value; + checksum += ++cmap_ii_put(&map, rnd, i)->value; break; case 2: entry = cmap_ii_get(map, rnd); @@ -47,7 +48,7 @@ int main() difference = clock() - before; printf("CMap: sz: %llu, bk: %llu, time: %.02f, sum: %llu, ins: %llu del: %llu\n", cmap_size(map), cmap_buckets(map), (float) difference / CLOCKS_PER_SEC, checksum, inserted, erased); cmap_ii_destroy(&map); - + std::unordered_map map2; std::unordered_map::const_iterator iter; @@ -60,7 +61,7 @@ int main() switch (op) { case 1: ++inserted; - checksum += ++(map2[rnd] = i-1); + checksum += ++(map2[rnd] = i); break; case 2: iter = map2.find(rnd); -- cgit v1.2.3