summaryrefslogtreecommitdiffhomepage
path: root/benchmarks
diff options
context:
space:
mode:
authorTyge Lovset <[email protected]>2022-07-11 23:53:06 +0200
committerTyge Lovset <[email protected]>2022-07-11 23:53:06 +0200
commit839efba934c8623f2dea31e7f8bb2857624c6908 (patch)
tree218e165ae2b65f6c2be41ea8169fb71432b4e68e /benchmarks
parent5082397444550d9486783fe498629524a64d564e (diff)
downloadSTC-modified-839efba934c8623f2dea31e7f8bb2857624c6908.tar.gz
STC-modified-839efba934c8623f2dea31e7f8bb2857624c6908.zip
Fixed documentation changes for size, capacity, empty. Minor changes in some ex. and map shootout.
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/shootout_hashmaps.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/benchmarks/shootout_hashmaps.cpp b/benchmarks/shootout_hashmaps.cpp
index a01f62a1..2ae4bf11 100644
--- a/benchmarks/shootout_hashmaps.cpp
+++ b/benchmarks/shootout_hashmaps.cpp
@@ -32,6 +32,7 @@ KHASH_MAP_INIT_INT64(ii, int64_t)
#define i_key int64_t
#define i_val int64_t
#define i_tag ii
+#define i_hash(x) (*x * 0xc6a4a7935bd1e99d) // optional
#include <stc/cmap.h>
#define SEED(s) rng = stc64_new(s)
@@ -67,7 +68,7 @@ KHASH_MAP_INIT_INT64(ii, int64_t)
#define UMAP_EMPLACE(X, key, val) map.emplace(key, val).first->second
#define UMAP_FIND(X, key) int(map.find(key) != map.end())
#define UMAP_ERASE(X, key) map.erase(key)
-#define UMAP_FOR(X, i) for (auto i: map)
+#define UMAP_FOR(X, i) for (const auto& i: map)
#define UMAP_ITEM(X, i) i.second
#define UMAP_SIZE(X) map.size()
#define UMAP_BUCKETS(X) map.bucket_count()
@@ -268,7 +269,7 @@ int main(int argc, char* argv[])
unsigned n_mill = argc >= 2 ? atoi(argv[1]) : DEFAULT_N_MILL;
unsigned keybits = argc >= 3 ? atoi(argv[2]) : DEFAULT_KEYBITS;
unsigned n = n_mill * 1000000;
- unsigned N0 = n, N1 = n/2, N2 = n/2, N3 = n, N4 = n, N5 = n;
+ unsigned N0 = n, N1 = n/2, N2 = n/2, N3 = n, N4 = n, N5 = n/2;
stc64_t rng;
size_t seed = time(NULL);
@@ -283,7 +284,7 @@ int main(int argc, char* argv[])
"DMAP = https://github.com/martinus/unordered_dense\n"
"EMAP = https://github.com//ktprime/emhash\n"
"UMAP = std::unordered_map\n\n");
-
+
printf("Usage %s [n-million=%d key-bits=%d]\n", argv[0], DEFAULT_N_MILL, DEFAULT_KEYBITS);
printf("N-base = %d. Random keys are in range [0, 2^%d). Seed = %" PRIuMAX ":\n", n_mill, keybits, seed);