forked from MassiveAtoms/hashmap-bench
Some documentation
This commit is contained in:
@@ -28,11 +28,17 @@
|
||||
using std::string;
|
||||
using absl::Hash;
|
||||
|
||||
|
||||
// this is the prepare function, again using template
|
||||
// this is for all maps which only need this. Below are the ones that
|
||||
// need something different
|
||||
template<class T>
|
||||
void prepare(T& map, int size) {
|
||||
map.reserve(size);
|
||||
}
|
||||
|
||||
// needs a tombstone marker(a key that's exclusively used to signify something
|
||||
// is deleted) and it doesn't have a reserve(size) member
|
||||
void prepare(google::sparse_hash_map<int, int>& map, int size) {
|
||||
map.set_deleted_key(-1);
|
||||
}
|
||||
@@ -41,6 +47,10 @@ void prepare(google::sparse_hash_map<string, string>& map, int size) {
|
||||
map.set_deleted_key("a");
|
||||
}
|
||||
|
||||
// needs a tombstone marker(a key that's exclusively used to signify something
|
||||
// is deleted) and an empty key marker
|
||||
// and it doesn't have a reserve(size) member
|
||||
|
||||
void prepare(google::dense_hash_map<int, int>& map, int size) {
|
||||
map.set_empty_key(0);
|
||||
map.set_deleted_key(-1);
|
||||
@@ -51,7 +61,9 @@ void prepare(google::dense_hash_map<string, string>& map, int size) {
|
||||
map.set_empty_key("");
|
||||
}
|
||||
|
||||
|
||||
// with abseil hash
|
||||
// this is a repeat of the 4 written above, but with types that accept abseil::Hash as hashing function
|
||||
void prepare(google::sparse_hash_map<int, int, Hash<int>>& map, int size) {
|
||||
map.set_deleted_key(-1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user