summaryrefslogtreecommitdiffhomepage
path: root/benchmarks
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-05-09 14:22:23 +0200
committerTyge Løvset <[email protected]>2022-05-09 14:22:23 +0200
commita34354bd24d81949567a1480209a2f7bbbe3bfbe (patch)
tree72adf4c0c844913dd0bb975cbfbc805a0549a15b /benchmarks
parente9c30e66af9c5c3054735eeb65c0bb384dea96b4 (diff)
downloadSTC-modified-a34354bd24d81949567a1480209a2f7bbbe3bfbe.tar.gz
STC-modified-a34354bd24d81949567a1480209a2f7bbbe3bfbe.zip
Small improvement in c_default_hash()
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/shootout_hashmaps.cpp27
1 files changed, 4 insertions, 23 deletions
diff --git a/benchmarks/shootout_hashmaps.cpp b/benchmarks/shootout_hashmaps.cpp
index 4ed961e7..5fea8c9a 100644
--- a/benchmarks/shootout_hashmaps.cpp
+++ b/benchmarks/shootout_hashmaps.cpp
@@ -134,7 +134,7 @@ size_t seed;
#define PMAP_DTOR(X) UMAP_DTOR(X)
-#define MAP_TEST0(M, X, n) \
+#define MAP_TEST1(M, X, n) \
{ /* Insert, update */ \
M##_SETUP(X, int64_t, int64_t); \
uint64_t sum = 0; \
@@ -149,22 +149,6 @@ size_t seed;
M##_DTOR(X); \
}
-#define MAP_TEST1(M, X, n) \
-{ /* Insert, update and erase another */ \
- M##_SETUP(X, int64_t, int64_t); \
- uint64_t sum = 0, erased = 0; \
- SEED(seed); \
- clock_t difference, before = clock(); \
- for (size_t i = 0; i < n; ++i) { \
- sum += ++ M##_EMPLACE(X, RAND(keybits), i); \
- erased += M##_ERASE(X, RAND(keybits)); \
- } \
- difference = clock() - before; \
- printf(#M ": time: %5.02f, size: %" PRIuMAX ", buckets: %8zu, erased %" PRIuMAX ", sum: %" PRIuMAX "\n", \
- (float) difference / CLOCKS_PER_SEC, (size_t) M##_SIZE(X), (size_t) M##_BUCKETS(X), erased, sum); \
- M##_DTOR(X); \
-}
-
#define MAP_TEST2(M, X, n) \
{ /* Insert sequential keys, then erase them */ \
M##_SETUP(X, int64_t, int64_t); \
@@ -240,12 +224,12 @@ size_t seed;
#ifdef __cplusplus
-#define RUN_TEST(n) MAP_TEST##n(CMAP, ii, N##n) MAP_TEST##n(KMAP, ii, N##n) \
+#define RUN_TEST(n) MAP_TEST##n(KMAP, ii, N##n) MAP_TEST##n(CMAP, ii, N##n) \
MAP_TEST##n(PMAP, ii, N##n) MAP_TEST##n(FMAP, ii, N##n) \
MAP_TEST##n(RMAP, ii, N##n) MAP_TEST##n(HMAP, ii, N##n) \
MAP_TEST##n(TMAP, ii, N##n) MAP_TEST##n(UMAP, ii, N##n)
#else
-#define RUN_TEST(n) MAP_TEST##n(CMAP, ii, N##n) MAP_TEST##n(KMAP, ii, N##n)
+#define RUN_TEST(n) MAP_TEST##n(KMAP, ii, N##n) MAP_TEST##n(CMAP, ii, N##n)
#endif
enum {
@@ -274,10 +258,7 @@ int main(int argc, char* argv[])
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);
- printf("\nT0: Insert/update random keys:\n");
- RUN_TEST(0)
-
- printf("\nT1: Insert/update random key + try to remove another random key:\n");
+ printf("\nT1: Insert/update random keys:\n");
RUN_TEST(1)
printf("\nT2: Insert sequential keys, then remove them in same order:\n");