hashmap-bench/main.cpp
2020-02-06 22:28:32 -03:00

117 lines
4.5 KiB
C++

#include <iostream>
#include <functional>
#include "./src/includes/aggregate_tests.h"
// // we can use to switch the map implementations to that
// // we can add some cli handling so we can specify which maps to tests (or all)
// typedef std::unordered_map<int, int> intmap;
// typedef std::unordered_map<string, string> stringmap;
//
// // google sparse
// typedef google::sparse_hash_map<int, int> intmap;
// typedef google::sparse_hash_map<string,string> stringmap;
//
// // google dense
// typedef google::dense_hash_map<int, int> intmap;
// typedef google::dense_hash_map<string,string> stringmap;
//
// // abseil nodehashmap
typedef absl::node_hash_map<int, int> intmap;
typedef absl::node_hash_map<string,string> stringmap;
//
// // flat hashmap
// typedef absl::flat_hash_map<int, int> intmap;
// typedef absl::flat_hash_map<string,string> stringmap;
//
// // tessil flat hashmap
// typedef tsl::sparse_map<int, int> intmap;
// typedef tsl::sparse_map<string,string> stringmap;
//
// // Tessil tsl::array_map
// typedef tsl::array_map<int, int> intmap;
// typedef tsl::array_map<string,string> stringmap;
//
// // Tessil tsl::ordered_map
// typedef tsl::ordered_map<int, int> intmap;
// typedef tsl::ordered_map<string,string> stringmap;
//
// // Tessil tsl::robin_map
// typedef tsl::robin_map<int, int> intmap;
// typedef tsl::robin_map<string,string> stringmap;
//
// // Tessil hopscotch_map
// typedef tsl::hopscotch_map<int, int> intmap;
// typedef tsl::hopscotch_map<string,string> stringmap;
//
// // Boost::unordered_map
// typedef boost::unordered_map<int, int> intmap;
// typedef boost::unordered_map<string,string> stringmap;
//
// // skarupke's unordered map
// typedef ska::unordered_map<int, int> intmap;
// typedef ska::unordered_map<string,string> stringmap;
//
// // skarupke's bytell hash map
// typedef ska::bytell_hash_map<int, int> intmap;
// typedef ska::bytell_hash_map<string,string> stringmap;
//
// // skarupke's flat hash map
// typedef ska::flat_hash_map<int, int> intmap;
// typedef ska::flat_hash_map<string,string> stringmap;
//
// // greg7mdp's flat hash map
// typedef phmap::parallel_flat_hash_map<int, int> intmap;
// typedef phmap::parallel_flat_hash_map<string,string> stringmap;
//
// // greg7mdp's hash map
// typedef phmap::parallel_node_hash_map<int, int> intmap;
// typedef phmap::parallel_node_hash_map<string,string> stringmap;
// // emilib's hash map
// typedef emilib::HashMap<int, int> intmap;
// typedef emilib::HashMap<string,string> stringmap;
// // martin flat map
// typedef robin_hood::unordered_flat_map<int, int> intmap;
// typedef robin_hood::unordered_flat_map<string,string> stringmap;
// // martin flat map
// typedef robin_hood::unordered_node_map<int, int> intmap;
// typedef robin_hood::unordered_node_map<string,string> stringmap;
int main() {
time_point<steady_clock> start_test = steady_clock::now();
// string_test(stringmap{}, 1); // process gets killed for sizes >35000
int_test_aggregate(intmap{}, 2);
string_test_aggregate(stringmap{}, 2);
time_point<steady_clock> end_test = steady_clock::now();
std::cout << "\n\n 30 runs for all tests for 1 map: " << duration_cast<seconds>(end_test-start_test).count() << " seconds\n\n";
// test takes 2hrs for 30 runs for one hashmap
/* if the other maps have about the same operation times ************
// possible maps to bench. priorities are that the interface must be the same/similar to unordered_map
// and that we don't have to jump through hoops to get it to work
1. Google dense_hash_map [y] https://github.com/sparsehash/sparsehash
2. Google sparse_hash_map [y]
3. abseil node_hash_map [y] https://abseil.io/docs/cpp/tools/cmake-installs
4. abseil flat_hash_map [y]
5. Tessil/sparse-map/ [y] header only implementation for all tessil
6. Tessil/hopscotch-map[y]
7. tessil/robin-map[y] [y]
8. Boost unordered_map [y] just install boost with your package manager
9. skarupke/flat_hash_map [y] header only implementation
10. skarupke /bytell_hash_map [y]
11. skarupke/unordered_map [y]
12. greg7mdp/parallel-hashmap/paralel_flat [y] header only
13. greg7mdp/parallel-hashmap/paralel_node [y]
17. emilk/emilib emilib::hashmap [y] header only
18. martinus robin_hood::unordered_node_map [y]
19. martinus/robin_hood/ flatmap [y]
3. folly F14ValueMap
4. folly F14NodeMap
5. Tessil/ordered-map [n] something is wrong with this one, verrrrry slow
6. Tessil/array-hash[n] (not with a small modification of the insert function)
*/
}