summaryrefslogtreecommitdiffhomepage
path: root/benchmark.cpp
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2020-03-17 12:45:08 +0100
committerGitHub <[email protected]>2020-03-17 12:45:08 +0100
commitffcf5bb152489bff4263ca17c07a5640af871a29 (patch)
treec4c46df0ab5c171fe8f9b13974a66bc73605be8e /benchmark.cpp
parent4e4314180f6cf6861cba962efe36701edde71ce4 (diff)
downloadSTC-modified-ffcf5bb152489bff4263ca17c07a5640af871a29.tar.gz
STC-modified-ffcf5bb152489bff4263ca17c07a5640af871a29.zip
Add files via upload
Diffstat (limited to 'benchmark.cpp')
-rw-r--r--benchmark.cpp9
1 files changed, 5 insertions, 4 deletions
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<int64_t, int64_t> map2;
std::unordered_map<int64_t, int64_t>::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);