From 4941fd617ae1c6a638be9cdaca6762033a58c532 Mon Sep 17 00:00:00 2001 From: TinyAtoms Date: Fri, 7 Feb 2020 15:20:35 -0300 Subject: [PATCH] MOREOPTIONS --- results.csv | 186 ++++++++++++++++++++++++++++++++- src/includes/aggregate_tests.h | 15 ++- src/main.cpp | 167 ++++++++++++++--------------- 3 files changed, 281 insertions(+), 87 deletions(-) diff --git a/results.csv b/results.csv index b8d569a..6dbb290 100644 --- a/results.csv +++ b/results.csv @@ -446,4 +446,188 @@ int_delete, 'google::dense_hash_map >', int_insert, 'google::dense_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 159, 176, 161, 169, 190, 170, 177, 190, 200, 188, 193, 198, 203, 210 int_succ_lookup, 'google::dense_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 126, 106, 96, 102, 107, 101, 105, 115, 113, 112, 112, 122, 118, 121 int_nosucc_lookup, 'google::dense_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 292, 201, 160, 178, 182, 166, 177, 192, 189, 178, 182, 189, 195, 203 -int_delete, 'google::dense_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 142, 112, 99, 104, 113, 110, 112, 122, 121, 119, 115, 134, 132, 137 \ No newline at end of file +int_delete, 'google::dense_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 142, 112, 99, 104, 113, 110, 112, 122, 121, 119, 115, 134, 132, 137 +int_insert, 'std::unordered_map >', 333, 344, 214, 282 +int_succ_lookup, 'std::unordered_map >', 148, 175, 161, 136 +int_nosucc_lookup, 'std::unordered_map >', 367, 1313, 1279, 1878 +int_delete, 'std::unordered_map >', 105, 203, 241, 278 +int_insert, 'std::unordered_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 330, 320, 426, 385 +int_succ_lookup, 'std::unordered_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 152, 249, 300, 283 +int_nosucc_lookup, 'std::unordered_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 542, 1197, 2130, 2253 +int_delete, 'std::unordered_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 226, 317, 385, 364 +int_insert, 'google::sparse_hash_map >', 321, 175, 155, 224 +int_succ_lookup, 'google::sparse_hash_map >', 57, 50, 45, 70 +int_nosucc_lookup, 'google::sparse_hash_map >', 668, 823, 156, 1544 +int_delete, 'google::sparse_hash_map >', 68, 52, 60, 68 +int_insert, 'google::sparse_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 1076, 1280, 1192, 1528 +int_succ_lookup, 'google::sparse_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 115, 159, 160, 187 +int_nosucc_lookup, 'google::sparse_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 2889, 4313, 1268, 7285 +int_delete, 'google::sparse_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 132, 164, 181, 172 +int_insert, 'google::dense_hash_map >', 27, 29, 77, 39 +int_succ_lookup, 'google::dense_hash_map >', 12, 12, 27, 19 +int_nosucc_lookup, 'google::dense_hash_map >', 28, 29, 49, 41 +int_delete, 'google::dense_hash_map >', 11, 11, 23, 13 +int_insert, 'google::dense_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 191, 185, 301, 191 +int_succ_lookup, 'google::dense_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 133, 98, 147, 109 +int_nosucc_lookup, 'google::dense_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 367, 193, 212, 193 +int_delete, 'google::dense_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 93, 109, 169, 116 +int_insert, 'std::unordered_map >' +int_succ_lookup, 'std::unordered_map >' +int_nosucc_lookup, 'std::unordered_map >' +int_delete, 'std::unordered_map >' +int_insert, 'std::unordered_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >' +int_succ_lookup, 'std::unordered_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >' +int_nosucc_lookup, 'std::unordered_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >' +int_delete, 'std::unordered_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >' +int_insert, 'google::sparse_hash_map >' +int_succ_lookup, 'google::sparse_hash_map >' +int_nosucc_lookup, 'google::sparse_hash_map >' +int_delete, 'google::sparse_hash_map >' +int_insert, 'google::sparse_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >' +int_succ_lookup, 'google::sparse_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >' +int_nosucc_lookup, 'google::sparse_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >' +int_delete, 'google::sparse_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >' +int_insert, 'google::dense_hash_map >' +int_succ_lookup, 'google::dense_hash_map >' +int_nosucc_lookup, 'google::dense_hash_map >' +int_delete, 'google::dense_hash_map >' +int_insert, 'google::dense_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >' +int_succ_lookup, 'google::dense_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >' +int_nosucc_lookup, 'google::dense_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >' +int_delete, 'google::dense_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >' +int_insert, 'std::unordered_map >', 324, 340, 180, 213 +int_succ_lookup, 'std::unordered_map >', 162, 245, 111, 116 +int_nosucc_lookup, 'std::unordered_map >', 424, 1309, 1209, 1608 +int_delete, 'std::unordered_map >', 115, 332, 225, 277 +int_insert, 'std::unordered_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 404, 307, 354, 369 +int_succ_lookup, 'std::unordered_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 241, 238, 261, 270 +int_nosucc_lookup, 'std::unordered_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 902, 1150, 1792, 2215 +int_delete, 'std::unordered_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 416, 304, 322, 350 +int_insert, 'google::sparse_hash_map >', 348, 189, 158, 197 +int_succ_lookup, 'google::sparse_hash_map >', 119, 52, 44, 55 +int_nosucc_lookup, 'google::sparse_hash_map >', 723, 808, 158, 1498 +int_delete, 'google::sparse_hash_map >', 60, 50, 61, 58 +int_insert, 'google::sparse_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 1252, 1324, 1230, 1544 +int_succ_lookup, 'google::sparse_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 115, 150, 151, 183 +int_nosucc_lookup, 'google::sparse_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 2345, 4411, 1242, 7209 +int_delete, 'google::sparse_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 122, 206, 173, 169 +int_insert, 'google::dense_hash_map >', 25, 164, 87, 45 +int_succ_lookup, 'google::dense_hash_map >', 10, 29, 25, 20 +int_nosucc_lookup, 'google::dense_hash_map >', 25, 45, 79, 42 +int_delete, 'google::dense_hash_map >', 10, 18, 49, 13 +int_insert, 'google::dense_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 171, 258, 184, 179 +int_succ_lookup, 'google::dense_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 99, 145, 102, 109 +int_nosucc_lookup, 'google::dense_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 164, 317, 167, 182 +int_delete, 'google::dense_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 96, 200, 121, 113 +int_insert, 'absl::node_hash_map', 61, 116, 80, 91 +int_succ_lookup, 'absl::node_hash_map', 19, 91, 43, 46 +int_nosucc_lookup, 'absl::node_hash_map', 416, 87, 84, 89 +int_delete, 'absl::node_hash_map', 114, 108, 126, 115 +int_insert, 'absl::node_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 260, 173, 190, 195 +int_succ_lookup, 'absl::node_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 395, 146, 179, 180 +int_nosucc_lookup, 'absl::node_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 1363, 147, 150, 164 +int_delete, 'absl::node_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 180, 160, 198, 193 +int_insert, 'absl::flat_hash_map', 29, 29, 67, 54 +int_succ_lookup, 'absl::flat_hash_map', 8, 9, 60, 38 +int_nosucc_lookup, 'absl::flat_hash_map', 132, 36, 97, 52 +int_delete, 'absl::flat_hash_map', 24, 22, 45, 34 +int_insert, 'absl::flat_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 279, 164, 172, 268 +int_succ_lookup, 'absl::flat_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 134, 110, 127, 252 +int_nosucc_lookup, 'absl::flat_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 732, 147, 143, 205 +int_delete, 'absl::flat_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 190, 88, 116, 147 +int_insert, 'tsl::sparse_map >', 89, 63, 233, 112 +int_succ_lookup, 'tsl::sparse_map >', 21, 14, 77, 27 +int_nosucc_lookup, 'tsl::sparse_map >', 96, 79, 218, 91 +int_delete, 'tsl::sparse_map >', 46, 40, 51, 44 +int_insert, 'tsl::sparse_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 681, 448, 424, 561 +int_succ_lookup, 'tsl::sparse_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 99, 114, 122, 124 +int_nosucc_lookup, 'tsl::sparse_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 751, 469, 427, 719 +int_delete, 'tsl::sparse_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 246, 308, 304, 524 +int_insert, 'tsl::robin_map >', 18, 27, 29, 47 +int_succ_lookup, 'tsl::robin_map >', 10, 21, 26, 24 +int_nosucc_lookup, 'tsl::robin_map >', 21, 28, 30, 32 +int_delete, 'tsl::robin_map >', 18, 22, 118, 26 +int_insert, 'tsl::robin_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 136, 150, 147, 159 +int_succ_lookup, 'tsl::robin_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 102, 101, 108, 108 +int_nosucc_lookup, 'tsl::robin_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 122, 118, 111, 122 +int_delete, 'tsl::robin_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 124, 133, 117, 130 +int_insert, 'tsl::hopscotch_map >', 43, 102, 74, 78 +int_succ_lookup, 'tsl::hopscotch_map >', 12, 40, 25, 24 +int_nosucc_lookup, 'tsl::hopscotch_map >', 227, 108, 85, 83 +int_delete, 'tsl::hopscotch_map >', 18, 24, 53, 26 +int_insert, 'tsl::hopscotch_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 189, 203, 167, 223 +int_succ_lookup, 'tsl::hopscotch_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 129, 101, 105, 117 +int_nosucc_lookup, 'tsl::hopscotch_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 1117, 210, 163, 217 +int_delete, 'tsl::hopscotch_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 128, 102, 108, 128 +int_insert, 'boost::unordered::unordered_map >', 79, 309, 178, 192 +int_succ_lookup, 'boost::unordered::unordered_map >', 31, 132, 77, 86 +int_nosucc_lookup, 'boost::unordered::unordered_map >', 86, 191, 185, 225 +int_delete, 'boost::unordered::unordered_map >', 81, 379, 192, 366 +int_insert, 'boost::unordered::unordered_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 420, 517, 432, 285 +int_succ_lookup, 'boost::unordered::unordered_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 264, 313, 395, 254 +int_nosucc_lookup, 'boost::unordered::unordered_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 645, 277, 229, 245 +int_delete, 'boost::unordered::unordered_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 575, 382, 355, 321 +int_insert, 'ska::unordered_map >', 64, 136, 272, 212 +int_succ_lookup, 'ska::unordered_map >', 20, 39, 67, 83 +int_nosucc_lookup, 'ska::unordered_map >', 72, 114, 278, 210 +int_delete, 'ska::unordered_map >', 55, 202, 245, 222 +int_insert, 'ska::unordered_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 408, 448, 328, 355 +int_succ_lookup, 'ska::unordered_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 200, 410, 294, 259 +int_nosucc_lookup, 'ska::unordered_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 264, 403, 221, 245 +int_delete, 'ska::unordered_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 216, 318, 465, 204 +int_insert, 'ska::bytell_hash_map >', 48, 60, 91, 64 +int_succ_lookup, 'ska::bytell_hash_map >', 19, 17, 62, 22 +int_nosucc_lookup, 'ska::bytell_hash_map >', 73, 65, 106, 73 +int_delete, 'ska::bytell_hash_map >', 24, 23, 104, 28 +int_insert, 'ska::bytell_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 254, 258, 181, 208 +int_succ_lookup, 'ska::bytell_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 179, 199, 116, 122 +int_nosucc_lookup, 'ska::bytell_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 210, 191, 169, 207 +int_delete, 'ska::bytell_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 220, 119, 126, 145 +int_insert, 'ska::flat_hash_map >', 27, 33, 41, 112 +int_succ_lookup, 'ska::flat_hash_map >', 10, 15, 35, 46 +int_nosucc_lookup, 'ska::flat_hash_map >', 31, 35, 139, 268 +int_delete, 'ska::flat_hash_map >', 28, 18, 102, 72 +int_insert, 'ska::flat_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 246, 352, 367, 279 +int_succ_lookup, 'ska::flat_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 157, 208, 163, 184 +int_nosucc_lookup, 'ska::flat_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 200, 305, 126, 276 +int_delete, 'ska::flat_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 366, 273, 269, 329 +int_insert, 'phmap::parallel_flat_hash_map >', 51, 134, 208, 119 +int_succ_lookup, 'phmap::parallel_flat_hash_map >', 18, 32, 192, 66 +int_nosucc_lookup, 'phmap::parallel_flat_hash_map >', 322, 112, 125, 156 +int_delete, 'phmap::parallel_flat_hash_map >', 104, 64, 49, 222 +int_insert, 'phmap::parallel_flat_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 249, 484, 380, 570 +int_succ_lookup, 'phmap::parallel_flat_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 262, 228, 251, 173 +int_nosucc_lookup, 'phmap::parallel_flat_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 719, 239, 162, 325 +int_delete, 'phmap::parallel_flat_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 352, 306, 247, 185 +int_insert, 'phmap::parallel_node_hash_map >', 160, 186, 154, 307 +int_succ_lookup, 'phmap::parallel_node_hash_map >', 56, 83, 63, 78 +int_nosucc_lookup, 'phmap::parallel_node_hash_map >', 501, 212, 134, 205 +int_delete, 'phmap::parallel_node_hash_map >', 114, 271, 151, 176 +int_insert, 'phmap::parallel_node_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 379, 510, 263, 312 +int_succ_lookup, 'phmap::parallel_node_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 177, 245, 178, 186 +int_nosucc_lookup, 'phmap::parallel_node_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 1180, 342, 209, 249 +int_delete, 'phmap::parallel_node_hash_map, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 141, 177, 196, 212 +int_insert, 'emilib::HashMap >', 18, 30, 36, 37 +int_succ_lookup, 'emilib::HashMap >', 12, 49, 25, 41 +int_nosucc_lookup, 'emilib::HashMap >', 21, 55, 33, 35 +int_delete, 'emilib::HashMap >', 9, 31, 15, 23 +int_insert, 'emilib::HashMap, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 157, 195, 151, 198 +int_succ_lookup, 'emilib::HashMap, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 108, 99, 117, 114 +int_nosucc_lookup, 'emilib::HashMap, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 113, 103, 118, 120 +int_delete, 'emilib::HashMap, std::__cxx11::basic_string, absl::hash_internal::Hash > >', 96, 92, 108, 103 +int_insert, 'robin_hood::detail::Table, std::equal_to >', 36, 56, 32, 65 +int_succ_lookup, 'robin_hood::detail::Table, std::equal_to >', 17, 26, 20, 27 +int_nosucc_lookup, 'robin_hood::detail::Table, std::equal_to >', 117, 292, 53, 429 +int_delete, 'robin_hood::detail::Table, std::equal_to >', 31, 57, 54, 44 +int_insert, 'robin_hood::detail::Table, std::__cxx11::basic_string, absl::hash_internal::Hash >, std::equal_to > >', 189, 385, 155, 316 +int_succ_lookup, 'robin_hood::detail::Table, std::__cxx11::basic_string, absl::hash_internal::Hash >, std::equal_to > >', 75, 176, 102, 107 +int_nosucc_lookup, 'robin_hood::detail::Table, std::__cxx11::basic_string, absl::hash_internal::Hash >, std::equal_to > >', 642, 1383, 178, 2253 +int_delete, 'robin_hood::detail::Table, std::__cxx11::basic_string, absl::hash_internal::Hash >, std::equal_to > >', 180, 109, 141, 171 +int_insert, 'robin_hood::detail::Table, std::equal_to >', 42, 56, 60, 61 +int_succ_lookup, 'robin_hood::detail::Table, std::equal_to >', 18, 56, 41, 41 +int_nosucc_lookup, 'robin_hood::detail::Table, std::equal_to >', 140, 676, 113, 975 +int_delete, 'robin_hood::detail::Table, std::equal_to >', 22, 132, 79, 100 +int_insert, 'robin_hood::detail::Table, std::__cxx11::basic_string, absl::hash_internal::Hash >, std::equal_to > >', 144, 125, 115, 149 +int_succ_lookup, 'robin_hood::detail::Table, std::__cxx11::basic_string, absl::hash_internal::Hash >, std::equal_to > >', 212, 154, 150, 181 +int_nosucc_lookup, 'robin_hood::detail::Table, std::__cxx11::basic_string, absl::hash_internal::Hash >, std::equal_to > >', 791, 1431, 88, 2356 +int_delete, 'robin_hood::detail::Table, std::__cxx11::basic_string, absl::hash_internal::Hash >, std::equal_to > >', 259, 146, 142, 206 \ No newline at end of file diff --git a/src/includes/aggregate_tests.h b/src/includes/aggregate_tests.h index 208f58b..a75f109 100644 --- a/src/includes/aggregate_tests.h +++ b/src/includes/aggregate_tests.h @@ -7,8 +7,8 @@ vector sizes = { 50000, 100000, 150000, 200000, 250000, 300000, 350000, 400000, 500000, 600000, 700000, 800000, 900000, 1000000, - // 2000000, 3000000, 4000000, 5000000, 6000000, 7000000, 8000000, 9000000, 10000000, - // 15000000, 20000000, 25000000, 30000000, 35000000, 40000000, 45000000, 50000000 + 2000000, 3000000, 4000000, 5000000, 6000000, 7000000, 8000000, 9000000, 10000000, + 15000000, 20000000, 25000000, 30000000, 35000000, 40000000, 45000000, 50000000 }; // to print type info @@ -41,7 +41,7 @@ std::basic_string_view name(T var) { template -void int_test_aggregate(T map, int runs) { +void int_test_aggregate(T map, int runs, int maxsize=20000000) { std::ofstream output{"results.csv", std::ios_base::app}; for (int i = 0; i < runs; ++i) { string insert = "\nint_insert, '"; @@ -54,6 +54,9 @@ void int_test_aggregate(T map, int runs) { nosucc_lookup += string{name(map)} + "'"; delet += string{name(map)} + "'"; for (auto size : sizes) { + if (size > maxsize){ + break; + } vector results = int_test(map, size); insert += ", " + std::to_string(results[0]); @@ -70,7 +73,7 @@ void int_test_aggregate(T map, int runs) { template -void string_test_aggregate(T map, int runs) { +void string_test_aggregate(T map, int runs, int maxsize=20000000) { std::ofstream output{"results.csv", std::ios_base::app}; for (int i = 0; i < runs; ++i) { string insert = "\nint_insert, '"; @@ -83,8 +86,12 @@ void string_test_aggregate(T map, int runs) { nosucc_lookup += string{name(map)} + "'"; delet += string{name(map)} + "'"; for (auto size : sizes) { + if (size > maxsize){ + break; + } vector results = string_test(map, size); + insert += ", " + std::to_string(results[0]); succ_lookup += ", " + std::to_string(results[1]); nosucc_lookup += ", " + std::to_string(results[2]); diff --git a/src/main.cpp b/src/main.cpp index 5ab743b..8202119 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -18,84 +18,87 @@ string choicetext = "Select implementation to test: '-i 1 2 3 4' or '-i 1,2,3'. "8. emilk's emilib:: hashmap(1) \n" "9. martin's robin_hood:: hashmaps(2) \n"; +// default arguments +vector hashmaps = {1, 2, 3, 4, 5, 6, 7, 8, 9}; +bool use_abseil_hash = false; +int runs = 1; +int maxsize = 50000000; + int main(int argc, char** argv) { CLI::App app{"Hashmap benchmarks"}; - vector hashmaps = {1, 2, 3, 4, 5, 6, 7, 8, 9}; app.add_option("-i,--implementation", hashmaps, choicetext )->delimiter(','); - bool use_abseil_hash = false; app.add_option("-a,--abseil", use_abseil_hash, "use absl::Hash, default is false"); - int runs = 1; app.add_option("-r,--runs", runs, "total runs for each map, default is 1"); + app.add_option("-m, --maxsize", maxsize, "The max size of the hashmaps to test for. Default is 50 million."); CLI11_PARSE(app, argc, argv); - time_point start_test = steady_clock::now(); if (use_abseil_hash) { for (auto i : hashmaps) { switch (i) { case 1: { - int_test_aggregate(std::unordered_map{}, runs); - string_test_aggregate(std::unordered_map{}, runs); + int_test_aggregate(std::unordered_map{}, runs, maxsize); + string_test_aggregate(std::unordered_map{}, runs, maxsize); break; } case 2: { - int_test_aggregate(google::sparse_hash_map{}, runs); - string_test_aggregate(google::sparse_hash_map{}, runs); - int_test_aggregate(google::dense_hash_map{}, runs); - string_test_aggregate(google::dense_hash_map{}, runs); + int_test_aggregate(google::sparse_hash_map{}, runs, maxsize); + string_test_aggregate(google::sparse_hash_map{}, runs, maxsize); + int_test_aggregate(google::dense_hash_map{}, runs, maxsize); + string_test_aggregate(google::dense_hash_map{}, runs, maxsize); break; } case 3: { - int_test_aggregate(absl::node_hash_map{}, runs); - string_test_aggregate(absl::node_hash_map{}, runs); - int_test_aggregate(absl::flat_hash_map{}, runs); - string_test_aggregate(absl::flat_hash_map{}, runs); + int_test_aggregate(absl::node_hash_map{}, runs, maxsize); + string_test_aggregate(absl::node_hash_map{}, runs, maxsize); + int_test_aggregate(absl::flat_hash_map{}, runs, maxsize); + string_test_aggregate(absl::flat_hash_map{}, runs, maxsize); break; } case 4: { - int_test_aggregate(tsl::sparse_map{}, runs); - string_test_aggregate(tsl::sparse_map{}, runs); - // int_test_aggregate(tsl::array_map{}, runs); - // string_test_aggregate(tsl::array_map{}, runs); - // int_test_aggregate(tsl::ordered_map{}, runs); - // string_test_aggregate(tsl::ordered_map{}, runs); - int_test_aggregate(tsl::robin_map{}, runs); - string_test_aggregate(tsl::robin_map{}, runs); - int_test_aggregate(tsl::hopscotch_map{}, runs); - string_test_aggregate(tsl::hopscotch_map{}, runs); + int_test_aggregate(tsl::sparse_map{}, runs, maxsize); + string_test_aggregate(tsl::sparse_map{}, runs, maxsize); + // int_test_aggregate(tsl::array_map{}, runs, maxsize); + // string_test_aggregate(tsl::array_map{}, runs, maxsize); + // int_test_aggregate(tsl::ordered_map{}, runs, maxsize); + // string_test_aggregate(tsl::ordered_map{}, runs, maxsize); + int_test_aggregate(tsl::robin_map{}, runs, maxsize); + string_test_aggregate(tsl::robin_map{}, runs, maxsize); + int_test_aggregate(tsl::hopscotch_map{}, runs, maxsize); + string_test_aggregate(tsl::hopscotch_map{}, runs, maxsize); break; } case 5: { - int_test_aggregate(boost::unordered_map{}, runs); - string_test_aggregate(boost::unordered_map{}, runs); + int_test_aggregate(boost::unordered_map{}, runs, maxsize); + string_test_aggregate(boost::unordered_map{}, runs, maxsize); break; } case 6: { - int_test_aggregate(ska::unordered_map{}, runs); - string_test_aggregate(ska::unordered_map{}, runs); - int_test_aggregate(ska::bytell_hash_map{}, runs); - string_test_aggregate(ska::bytell_hash_map{}, runs); - int_test_aggregate(ska::flat_hash_map{}, runs); - string_test_aggregate(ska::flat_hash_map{}, runs); + int_test_aggregate(ska::unordered_map{}, runs, maxsize); + string_test_aggregate(ska::unordered_map{}, runs, maxsize); + int_test_aggregate(ska::bytell_hash_map{}, runs, maxsize); + string_test_aggregate(ska::bytell_hash_map{}, runs, maxsize); + int_test_aggregate(ska::flat_hash_map{}, runs, maxsize); + string_test_aggregate(ska::flat_hash_map{}, runs, maxsize); break; } case 7: { - int_test_aggregate(phmap::parallel_flat_hash_map{}, runs); - string_test_aggregate(phmap::parallel_flat_hash_map{}, runs); - int_test_aggregate(phmap::parallel_node_hash_map{}, runs); - string_test_aggregate(phmap::parallel_node_hash_map{}, runs); + int_test_aggregate(phmap::parallel_flat_hash_map{}, runs, maxsize); + string_test_aggregate(phmap::parallel_flat_hash_map{}, runs, maxsize); + int_test_aggregate(phmap::parallel_node_hash_map{}, runs, maxsize); + string_test_aggregate(phmap::parallel_node_hash_map{}, runs, maxsize); break; } case 8: { - int_test_aggregate(emilib::HashMap{}, runs); - string_test_aggregate(emilib::HashMap{}, runs); + int_test_aggregate(emilib::HashMap{}, runs, maxsize); + string_test_aggregate(emilib::HashMap{}, runs, maxsize); break; } case 9: { - int_test_aggregate(robin_hood::unordered_flat_map{}, runs); - string_test_aggregate(robin_hood::unordered_flat_map{}, runs); - int_test_aggregate(robin_hood::unordered_node_map{}, runs); - string_test_aggregate(robin_hood::unordered_node_map{}, runs); + int_test_aggregate(robin_hood::unordered_flat_map{}, runs, maxsize); + string_test_aggregate(robin_hood::unordered_flat_map{}, runs, maxsize); + int_test_aggregate(robin_hood::unordered_node_map{}, runs, maxsize); + string_test_aggregate(robin_hood::unordered_node_map{}, runs, maxsize); break; } } @@ -105,69 +108,69 @@ int main(int argc, char** argv) { for (auto i : hashmaps) { switch (i) { case 1: { - int_test_aggregate(std::unordered_map>{}, runs); - string_test_aggregate(std::unordered_map>{}, runs); + int_test_aggregate(std::unordered_map>{}, runs, maxsize); + string_test_aggregate(std::unordered_map>{}, runs, maxsize); break; } case 2: { - int_test_aggregate(google::sparse_hash_map>{}, runs); - string_test_aggregate(google::sparse_hash_map>{}, runs); - int_test_aggregate(google::dense_hash_map>{}, runs); - string_test_aggregate(google::dense_hash_map>{}, runs); + int_test_aggregate(google::sparse_hash_map>{}, runs, maxsize); + string_test_aggregate(google::sparse_hash_map>{}, runs, maxsize); + int_test_aggregate(google::dense_hash_map>{}, runs, maxsize); + string_test_aggregate(google::dense_hash_map>{}, runs, maxsize); break; } case 3: { - int_test_aggregate(absl::node_hash_map>{}, runs); - string_test_aggregate(absl::node_hash_map>{}, runs); - int_test_aggregate(absl::flat_hash_map>{}, runs); - string_test_aggregate(absl::flat_hash_map>{}, runs); + int_test_aggregate(absl::node_hash_map>{}, runs, maxsize); + string_test_aggregate(absl::node_hash_map>{}, runs, maxsize); + int_test_aggregate(absl::flat_hash_map>{}, runs, maxsize); + string_test_aggregate(absl::flat_hash_map>{}, runs, maxsize); break; } case 4: { - int_test_aggregate(tsl::sparse_map>{}, runs); - string_test_aggregate(tsl::sparse_map>{}, runs); - // int_test_aggregate(tsl::array_map>{}, runs); - // string_test_aggregate(tsl::array_map>{}, runs); - // int_test_aggregate(tsl::ordered_map>{}, runs); - // string_test_aggregate(tsl::ordered_map>{}, runs); - int_test_aggregate(tsl::robin_map>{}, runs); - string_test_aggregate(tsl::robin_map>{}, runs); - int_test_aggregate(tsl::hopscotch_map>{}, runs); - string_test_aggregate(tsl::hopscotch_map>{}, runs); + int_test_aggregate(tsl::sparse_map>{}, runs, maxsize); + string_test_aggregate(tsl::sparse_map>{}, runs, maxsize); + // int_test_aggregate(tsl::array_map>{}, runs, maxsize); + // string_test_aggregate(tsl::array_map>{}, runs, maxsize); + // int_test_aggregate(tsl::ordered_map>{}, runs, maxsize); + // string_test_aggregate(tsl::ordered_map>{}, runs, maxsize); + int_test_aggregate(tsl::robin_map>{}, runs, maxsize); + string_test_aggregate(tsl::robin_map>{}, runs, maxsize); + int_test_aggregate(tsl::hopscotch_map>{}, runs, maxsize); + string_test_aggregate(tsl::hopscotch_map>{}, runs, maxsize); break; } case 5: { - int_test_aggregate(boost::unordered_map>{}, runs); - string_test_aggregate(boost::unordered_map>{}, runs); + int_test_aggregate(boost::unordered_map>{}, runs, maxsize); + string_test_aggregate(boost::unordered_map>{}, runs, maxsize); break; } case 6: { - int_test_aggregate(ska::unordered_map>{}, runs); - string_test_aggregate(ska::unordered_map>{}, runs); - int_test_aggregate(ska::bytell_hash_map>{}, runs); - string_test_aggregate(ska::bytell_hash_map>{}, runs); - int_test_aggregate(ska::flat_hash_map>{}, runs); - string_test_aggregate(ska::flat_hash_map>{}, runs); + int_test_aggregate(ska::unordered_map>{}, runs, maxsize); + string_test_aggregate(ska::unordered_map>{}, runs, maxsize); + int_test_aggregate(ska::bytell_hash_map>{}, runs, maxsize); + string_test_aggregate(ska::bytell_hash_map>{}, runs, maxsize); + int_test_aggregate(ska::flat_hash_map>{}, runs, maxsize); + string_test_aggregate(ska::flat_hash_map>{}, runs, maxsize); break; } case 7: { - int_test_aggregate(phmap::parallel_flat_hash_map>{}, runs); - string_test_aggregate(phmap::parallel_flat_hash_map>{}, runs); - int_test_aggregate(phmap::parallel_node_hash_map>{}, runs); - string_test_aggregate(phmap::parallel_node_hash_map>{}, runs); + int_test_aggregate(phmap::parallel_flat_hash_map>{}, runs, maxsize); + string_test_aggregate(phmap::parallel_flat_hash_map>{}, runs, maxsize); + int_test_aggregate(phmap::parallel_node_hash_map>{}, runs, maxsize); + string_test_aggregate(phmap::parallel_node_hash_map>{}, runs, maxsize); break; } case 8: { - int_test_aggregate(emilib::HashMap>{}, runs); - string_test_aggregate(emilib::HashMap>{}, runs); + int_test_aggregate(emilib::HashMap>{}, runs, maxsize); + string_test_aggregate(emilib::HashMap>{}, runs, maxsize); break; } case 9: { - int_test_aggregate(robin_hood::unordered_flat_map>{}, runs); - string_test_aggregate(robin_hood::unordered_flat_map>{}, runs); - int_test_aggregate(robin_hood::unordered_node_map>{}, runs); - string_test_aggregate(robin_hood::unordered_node_map>{}, runs); + int_test_aggregate(robin_hood::unordered_flat_map>{}, runs, maxsize); + string_test_aggregate(robin_hood::unordered_flat_map>{}, runs, maxsize); + int_test_aggregate(robin_hood::unordered_node_map>{}, runs, maxsize); + string_test_aggregate(robin_hood::unordered_node_map>{}, runs, maxsize); break; } @@ -177,8 +180,8 @@ int main(int argc, char** argv) { } time_point end_test = steady_clock::now(); - std::cout << "\n\n 30 runs for all tests for 1 map: " << duration_cast(end_test - start_test).count() - << " seconds\n\n"; + std::cout << "\n\n" << runs << " runs for all tests for " << hashmaps.size() << "maps: " + << duration_cast(end_test - start_test).count() << " seconds\n\n"; }