54 lines
1.8 KiB
C++
54 lines
1.8 KiB
C++
#include <iostream>
|
|
#include <unordered_map>
|
|
#include <functional>
|
|
#include <fstream>
|
|
// #include <sparsehash/sparse_hash_map>
|
|
|
|
#include "./src/includes/aggregate_tests.h"
|
|
|
|
|
|
|
|
|
|
// typedef google::sparse_hash_map<int, int> intmap;
|
|
// typedef google::sparse_hash_map<std::string,std::string> stringmap
|
|
typedef std::unordered_map<int, int> intmap;
|
|
typedef std::unordered_map<string, string> stringmap;
|
|
// 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)
|
|
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{}, 30);
|
|
string_test_aggregate(stringmap{}, 30);
|
|
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 52 mins for 10 runs for one hashmap
|
|
// so it'll take ~3 hours per map if we want 30 runs per test
|
|
/* if the other maps have about the same operation times ************
|
|
|
|
// maps to benchmark:
|
|
1. Google dense_hash_map
|
|
2. Google sparse_hash_map
|
|
3. folly F14ValueMap
|
|
4. folly F14NodeMap
|
|
5. Tessil/ordered-map
|
|
6. Tessil/array-hash
|
|
7. Tessil/hopscotch-map
|
|
8. Tessil/sparse-map/
|
|
9. abseil node_hash_map
|
|
10. abseil flat_hash_map
|
|
11. Glib GHashTable
|
|
12. Boost unordered_map
|
|
13. Qt QHash
|
|
14. skarupke/flat_hash_map
|
|
15. greg7mdp/sparsepp
|
|
16. greg7mdp /parallel-hashmap (phmap::flat_hash_map and phmap::node_hash_map)
|
|
17. emilk/emilib emilib::hashmap
|
|
18. martinus robin_hood::unordered_node_map
|
|
19. martinus/robin-hood-hashing/
|
|
20. skarupke /flat_hash_map
|
|
*/
|
|
|
|
}
|