Skip to content

Commit a8f0dc2

Browse files
committed
Add gtl hashmap
1 parent f8a2a7c commit a8f0dc2

File tree

5 files changed

+18
-5
lines changed

5 files changed

+18
-5
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ find_package(Boost REQUIRED)
1515
find_package(xxHash REQUIRED)
1616
find_package(fmt REQUIRED)
1717
find_package(cxxopts REQUIRED)
18+
find_path(GTL_INCLUDE_DIRS "gtl/adv_utils.hpp")
1819

1920
if(WITH_PCG32)
2021
find_path(PCG_INCLUDE_DIRS "pcg_extras.hpp")
@@ -51,9 +52,10 @@ if(WITH_PCG32)
5152
target_include_directories(speed_test PRIVATE ${PCG_INCLUDE_DIRS})
5253
target_include_directories(balance PRIVATE ${PCG_INCLUDE_DIRS})
5354
endif()
55+
target_include_directories(speed_test PRIVATE ${GTL_INCLUDE_DIRS})
56+
target_include_directories(balance PRIVATE ${GTL_INCLUDE_DIRS})
5457
target_link_libraries(speed_test PRIVATE xxHash::xxhash fmt::fmt cxxopts::cxxopts)
5558
target_link_libraries(balance PRIVATE xxHash::xxhash fmt::fmt cxxopts::cxxopts)
56-
5759
include(GNUInstallDirs)
5860
install(TARGETS speed_test
5961
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ The **speed_test** benchmark performs several random key lookups, the syntax is:
4141
./speed_test Algorithm AnchorSet WorkingSet NumRemovals Numkeys ResFilename
4242
```
4343
where
44-
* **Algorithm** can be *memento* (for MementoHash using *boost::unordered_flat_map* for the removal set), *mementoboost* (for MementoHash using *boost::unordered_map* for the removal set), *mementostd* (for MementoHash using *std::unordered_map* for the removal set), *mementomash* (for MementoHash using a hash table similar to Java's HashMap), *anchor* (for AnchorHash), *jump* (for JumpHash)
44+
* **Algorithm** can be *memento* (for MementoHash using *boost::unordered_flat_map* for the removal set), *mementoboost* (for MementoHash using *boost::unordered_map* for the removal set), *mementostd* (for MementoHash using *std::unordered_map* for the removal set), *mementomash* (for MementoHash using a hash table similar to Java's HashMap), *anchor* (for AnchorHash), *mementogtl* (for Memento with gtl hash map), *jump* (for JumpHash)
4545
* **AnchorSet** is the size of the Anchor set (**a**): this parameter is used only by *anchor* but must be set to a value *at least equal to WorkingSet* even with *MementoHash*;
4646
* **WorkingSet** is the size of the initial Working set (**w**);
4747
* **NumRemovals** is the number of nodes that should be removed (randomly, except for *Jump*) before starting the benchmark;

balance.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <fmt/core.h>
2929
#include <fstream>
3030
#include <unordered_map>
31+
#include <gtl/phmap.hpp>
3132

3233
/*
3334
* Benchmark routine
@@ -125,7 +126,7 @@ int main(int argc, char *argv[]) {
125126
cxxopts::Options options("speed_test", "MementoHash vs AnchorHash benchmark");
126127
options.add_options()(
127128
"Algorithm",
128-
"Algorithm (null|baseline|anchor|memento|mementoboost|mementomash|jump)",
129+
"Algorithm (null|baseline|anchor|memento|mementoboost|mementomash|mementostd|mementogtl|jump)",
129130
cxxopts::value<std::string>())(
130131
"AnchorSet", "Size of the AnchorSet (ignored by Memento)",
131132
cxxopts::value<int>())("WorkingSet", "Size of the WorkingSet",
@@ -192,6 +193,10 @@ int main(int argc, char *argv[]) {
192193
return bench<MementoEngine<std::unordered_map>>(
193194
"Memento<std::unordered_map>", filename, anchor_set, working_set,
194195
num_removals, num_keys);
196+
} else if (algorithm == "mementogtl") {
197+
return bench<MementoEngine<gtl::flat_hash_map>>(
198+
"Memento<std::gtl::flat_hash_map>", filename, anchor_set, working_set,
199+
num_removals, num_keys);
195200
} else if (algorithm == "mementomash") {
196201
return bench<MementoEngine<MashTable>>("Memento<MashTable>", filename,
197202
anchor_set, working_set,

speed_test.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <fmt/core.h>
2929
#include <fstream>
3030
#include <unordered_map>
31+
#include <gtl/phmap.hpp>
3132

3233
/*
3334
* ******************************************
@@ -190,7 +191,7 @@ int main(int argc, char *argv[]) {
190191
cxxopts::Options options("speed_test", "MementoHash vs AnchorHash benchmark");
191192
options.add_options()(
192193
"Algorithm",
193-
"Algorithm (null|baseline|anchor|memento|mementoboost|mementomash|jump)",
194+
"Algorithm (null|baseline|anchor|memento|mementoboost|mementomash|mementostd|mementogtl|jump)",
194195
cxxopts::value<std::string>())(
195196
"AnchorSet", "Size of the AnchorSet (ignored by Memento)",
196197
cxxopts::value<int>())("WorkingSet", "Size of the WorkingSet",
@@ -269,6 +270,10 @@ int main(int argc, char *argv[]) {
269270
return bench<MementoEngine<std::unordered_map>>(
270271
"Memento<std::unordered_map>", filename, anchor_set, working_set,
271272
num_removals, num_keys);
273+
} else if (algorithm == "mementogtl") {
274+
return bench<MementoEngine<gtl::flat_hash_map>>(
275+
"Memento<std::gtl::flat_hash_map>", filename, anchor_set, working_set,
276+
num_removals, num_keys);
272277
} else if (algorithm == "mementomash") {
273278
return bench<MementoEngine<MashTable>>("Memento<MashTable>", filename,
274279
anchor_set, working_set,

vcpkg.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"fmt",
88
"cxxopts",
99
"xxhash",
10-
"pcg"
10+
"pcg",
11+
"gtl"
1112
]
1213
}

0 commit comments

Comments
 (0)