diff --git a/bench/Makefile b/bench/Makefile index 56e1ef18..1a228d3f 100644 --- a/bench/Makefile +++ b/bench/Makefile @@ -194,6 +194,7 @@ bench-flathashmap0: $(CXX) -std=c++14 $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) -I "$${FLATHASHMAP}" bench-flathashmap.cpp -o bench-flathashmap.exe @./bench-flathashmap.exe 41 @./bench-flathashmap.exe 42 + @./bench-flathashmap.exe 46 @./bench-flathashmap.exe 43 # HOPSCOTCHMAP shall point to the directory where the source are diff --git a/bench/bench-flathashmap.cpp b/bench/bench-flathashmap.cpp index aa50b3c2..7a826964 100644 --- a/bench/bench-flathashmap.cpp +++ b/bench/bench-flathashmap.cpp @@ -42,6 +42,23 @@ test_dict2(size_t n) g_result = s; } +static void +test_dict2_linear(size_t n) +{ + flat_hash_map dict; + for (size_t i = 0; i < n; i++) { + dict[i] = rand_get(); + } + rand_init(); + unsigned int s = 0; + for (size_t i = 0; i < n; i++) { + flat_hash_map::iterator it = dict.find(i); + if (it != dict.end()) + s += it->second; + } + g_result = s; +} + /********************************************************************************************/ struct char_array_s { char a[256]; @@ -113,6 +130,8 @@ int main(int argc, const char *argv[]) int n = (argc > 1) ? atoi(argv[1]) : 0; if (n == 42) test_function("Dict(u)time", 1000000, test_dict2); + if (n == 46) + test_function("Dict(u+l)time", 1000000, test_dict2_linear); if (n == 41) test_function("DictB time", 1000000, test_dict_big); if (n == 43)