finished all stuff
This commit is contained in:
@@ -4,82 +4,95 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
// hashmaps and hash
|
||||
#include <unordered_map>
|
||||
#include "3thparty/sparsehash/sparse_hash_map"
|
||||
#include "3thparty/sparsehash/dense_hash_map"
|
||||
#include "./3thparty/abseil-cpp/absl/container/node_hash_map.h"
|
||||
#include "./3thparty/abseil-cpp/absl/container/flat_hash_map.h"
|
||||
#include "./3thparty/abseil-cpp/absl/container/node_hash_map.h"
|
||||
#include "./3thparty/abseil-cpp/absl/hash/hash.h"
|
||||
#include "./3thparty/tsl/sparse_map.h"
|
||||
#include "./3thparty/tsl/array_map.h"
|
||||
#include "./3thparty/tsl/ordered_map.h"
|
||||
#include "./3thparty/tsl/robin_map.h"
|
||||
#include "./3thparty/tsl/hopscotch_map.h"
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include "./3thparty/emilib/hash_map.hpp"
|
||||
#include "./3thparty/parallel_hashmap/phmap.h"
|
||||
#include "./3thparty/skarupke/bytell_hash_map.hpp"
|
||||
#include "./3thparty/skarupke/flat_hash_map.hpp"
|
||||
#include "./3thparty/skarupke/unordered_map.hpp"
|
||||
#include "./3thparty/parallel_hashmap/phmap.h"
|
||||
#include "./3thparty/emilib/hash_map.hpp"
|
||||
#include "./3thparty/tsl/array_map.h"
|
||||
#include "./3thparty/tsl/hopscotch_map.h"
|
||||
#include "./3thparty/tsl/ordered_map.h"
|
||||
#include "./3thparty/tsl/robin_map.h"
|
||||
#include "./3thparty/tsl/sparse_map.h"
|
||||
#include "3thparty/robinhood/robin_hood.h"
|
||||
#include "3thparty/sparsehash/dense_hash_map"
|
||||
#include "3thparty/sparsehash/sparse_hash_map"
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include <unordered_map>
|
||||
|
||||
using std::string;
|
||||
using absl::Hash;
|
||||
|
||||
using std::string;
|
||||
|
||||
// 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);
|
||||
}
|
||||
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);
|
||||
void prepare(google::sparse_hash_map<int, int> &map, int size) {
|
||||
map.set_deleted_key(-1);
|
||||
map.rehash(size);
|
||||
map.resize(size);
|
||||
}
|
||||
|
||||
void prepare(google::sparse_hash_map<string, string>& map, int size) {
|
||||
map.set_deleted_key("a");
|
||||
void prepare(google::sparse_hash_map<string, string> &map, int size) {
|
||||
map.set_deleted_key("a");
|
||||
map.rehash(size);
|
||||
map.resize(size);
|
||||
}
|
||||
|
||||
// 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);
|
||||
void prepare(google::dense_hash_map<int, int> &map, int size) {
|
||||
map.set_empty_key(0);
|
||||
map.set_deleted_key(-1);
|
||||
map.rehash(size);
|
||||
map.resize(size);
|
||||
}
|
||||
|
||||
void prepare(google::dense_hash_map<string, string>& map, int size) {
|
||||
map.set_deleted_key("a");
|
||||
map.set_empty_key("");
|
||||
void prepare(google::dense_hash_map<string, string> &map, int size) {
|
||||
map.set_deleted_key("a");
|
||||
map.set_empty_key("");
|
||||
map.rehash(size);
|
||||
map.resize(size);
|
||||
}
|
||||
|
||||
|
||||
// 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);
|
||||
// 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);
|
||||
map.rehash(size);
|
||||
map.resize(size);
|
||||
}
|
||||
|
||||
void prepare(google::sparse_hash_map<string, string, Hash<string>>& map, int size) {
|
||||
map.set_deleted_key("a");
|
||||
void prepare(google::sparse_hash_map<string, string, Hash<string>> &map,
|
||||
int size) {
|
||||
map.set_deleted_key("a");
|
||||
map.rehash(size);
|
||||
map.resize(size);
|
||||
}
|
||||
|
||||
void prepare(google::dense_hash_map<int, int, Hash<int>>& map, int size) {
|
||||
map.set_empty_key(0);
|
||||
map.set_deleted_key(-1);
|
||||
void prepare(google::dense_hash_map<int, int, Hash<int>> &map, int size) {
|
||||
map.set_empty_key(0);
|
||||
map.set_deleted_key(-1);
|
||||
map.rehash(size);
|
||||
map.resize(size);
|
||||
}
|
||||
|
||||
void prepare(google::dense_hash_map<string, string, Hash<string>>& map, int size) {
|
||||
map.set_deleted_key("a");
|
||||
map.set_empty_key("");
|
||||
void prepare(google::dense_hash_map<string, string, Hash<string>> &map,
|
||||
int size) {
|
||||
map.set_deleted_key("a");
|
||||
map.set_empty_key("");
|
||||
map.rehash(size);
|
||||
map.resize(size);
|
||||
}
|
||||
|
||||
#endif /* TESTS_H */
|
@@ -82,6 +82,7 @@ vector<int> int_test(T map, int size) {
|
||||
|
||||
|
||||
// insertion test
|
||||
// testmap.rehash(testmap.bucket_count()+1); // force a rehash so insertion test has a smaller chance of rehashing during the test
|
||||
time_point<steady_clock> insert_start = steady_clock::now();
|
||||
for (auto key : insert_keys) {
|
||||
testmap.insert({key, key});
|
||||
|
Reference in New Issue
Block a user