summaryrefslogtreecommitdiffhomepage
path: root/benchmarks/shootout1_cmap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'benchmarks/shootout1_cmap.cpp')
-rw-r--r--benchmarks/shootout1_cmap.cpp29
1 files changed, 16 insertions, 13 deletions
diff --git a/benchmarks/shootout1_cmap.cpp b/benchmarks/shootout1_cmap.cpp
index fab25096..87790844 100644
--- a/benchmarks/shootout1_cmap.cpp
+++ b/benchmarks/shootout1_cmap.cpp
@@ -7,7 +7,7 @@
#include "others/robin_hood.hpp"
#include "others/skarupke/bytell_hash_map.hpp"
#include "others/tsl/hopscotch_map.h"
-#include "others/sparsepp/spp.h"
+#include "others/parallel_hashmap/phmap.h"
#define PICOBENCH_IMPLEMENT_WITH_MAIN
#include "picobench.hpp"
@@ -19,15 +19,15 @@ template <class K, class V> using umap = std::unordered_map<K, V>;
template <class K, class V> using bmap = ska::bytell_hash_map<K, V>;
template <class K, class V> using fmap = ska::flat_hash_map<K, V>;
template <class K, class V> using hmap = tsl::hopscotch_map<K, V>;
-template <class K, class V> using smap = spp::sparse_hash_map<K, V>;
-template <class K, class V> using rmap = robin_hood::unordered_flat_map<K, V, robin_hood::hash<K>,
- std::equal_to<K>, MaxLoadFactor100>;
+template <class K, class V> using pmap = phmap::flat_hash_map<K, V>;
+template <class K, class V> using rmap = robin_hood::unordered_flat_map<K, V,
+ robin_hood::hash<K>, std::equal_to<K>, MaxLoadFactor100>;
#define DEFMAP(map, ...) \
using u##map = umap __VA_ARGS__; \
using b##map = bmap __VA_ARGS__; \
using f##map = fmap __VA_ARGS__; \
using h##map = hmap __VA_ARGS__; \
- using s##map = smap __VA_ARGS__; \
+ using p##map = pmap __VA_ARGS__; \
using r##map = rmap __VA_ARGS__
@@ -119,7 +119,7 @@ PICOBENCH(ins_and_erase_i<umap_x>).P;
PICOBENCH(ins_and_erase_i<bmap_x>).P;
PICOBENCH(ins_and_erase_i<fmap_x>).P;
PICOBENCH(ins_and_erase_i<hmap_x>).P;
-PICOBENCH(ins_and_erase_i<smap_x>).P;
+PICOBENCH(ins_and_erase_i<pmap_x>).P;
PICOBENCH(ins_and_erase_i<rmap_x>).P;
PICOBENCH(ins_and_erase_cmap_x).P;
#undef P
@@ -161,7 +161,7 @@ PICOBENCH(ins_and_access_i<umap_i>).P;
PICOBENCH(ins_and_access_i<bmap_i>).P;
PICOBENCH(ins_and_access_i<fmap_i>).P;
PICOBENCH(ins_and_access_i<hmap_i>).P;
-PICOBENCH(ins_and_access_i<smap_i>).P;
+PICOBENCH(ins_and_access_i<pmap_i>).P;
PICOBENCH(ins_and_access_i<rmap_i>).P;
PICOBENCH(ins_and_access_cmap_i).P;
#undef P
@@ -169,9 +169,11 @@ PICOBENCH(ins_and_access_cmap_i).P;
PICOBENCH_SUITE("Map3");
static void randomize(char* str, size_t len) {
- union {uint64_t i; char c[8];} r = {.i = stc64_random()};
- for (int i = len - 7, j = 0; i < len; ++j, ++i)
- str[i] = (r.c[j] & 63) + 48;
+ for (int k=0; k < len; ++k) {
+ union {uint64_t i; char c[8];} r = {.i = stc64_random()};
+ for (int i=0; i<8 && k<len; ++k, ++i)
+ str[k] = (r.c[i] & 63) + 48;
+ }
}
template <class MapStr>
@@ -204,8 +206,9 @@ static void ins_and_access_cmap_s(picobench::state& s)
picobench::scope scope(s);
c_forrange (s.iterations()) {
randomize(str.str, cstr_size(str));
+ //if (cstr_size(str) > 30) { printf("%s\n", str.str); exit(0); }
cmap_str_emplace(&map, str.str, str.str);
- randomize(str.str, cstr_size(str));
+ //randomize(str.str, cstr_size(str));
result += cmap_str_erase(&map, str.str);
}
s.set_result(result + cmap_str_size(map));
@@ -218,7 +221,7 @@ PICOBENCH(ins_and_access_s<umap_s>).P;
PICOBENCH(ins_and_access_s<bmap_s>).P;
PICOBENCH(ins_and_access_s<fmap_s>).P;
PICOBENCH(ins_and_access_s<hmap_s>).P;
-PICOBENCH(ins_and_access_s<smap_s>).P;
+PICOBENCH(ins_and_access_s<pmap_s>).P;
PICOBENCH(ins_and_access_s<rmap_s>).P;
PICOBENCH(ins_and_access_cmap_s).P;
#undef P
@@ -291,7 +294,7 @@ PICOBENCH(iterate_x<umap_x>).P;
PICOBENCH(iterate_x<bmap_x>).P;
PICOBENCH(iterate_x<fmap_x>).P;
PICOBENCH(iterate_x<hmap_x>).P;
-PICOBENCH(iterate_x<smap_x>).P;
+PICOBENCH(iterate_x<pmap_x>).P;
PICOBENCH(iterate_x<rmap_x>).P;
PICOBENCH(iterate_cmap_x).P;
#undef P