# Parallel hashmap benchmarks ## Benchmarks TBW ## Detailed results ### Folder * `gcc-x64`: GCC 11, x64 * `clang-x64`: Clang 12, x64 * `vs-x64`: Visual Studio 2019, x64 * `clang-arm64`: Clang 12 ARM64 * `gcc-x86`: GCC 11, x86 * `clang-x86`: Clang 12, x86 * `vs-x86`: Visual Studio 2019, x86 ## Summary results ### GCC 11, x64 ``` main.cpp Number of threads: 16 boost::unordered_flat_map, single threaded: 7737 ms boost::unordered_flat_map, single threaded, shared_mutex: 11680 ms boost::unordered_flat_map, single threaded, rw_spinlock: 9287 ms cfoa, single threaded: 12720 ms cfoa, tbb::spin_rw_mutex, single threaded: 12467 ms cfoa, std::shared_mutex, single threaded: 14298 ms foa::concurrent_table, single threaded: 12132 ms tbb::concurrent_hash_map, single threaded: 21985 ms boost::unordered_flat_map, sharded_prehashed: 6555 ms boost::unordered_flat_map, sharded_prehashed: 13913 ms boost::unordered_flat_map, sharded_prehashed: 7238 ms boost::unordered_flat_map, sharded isolated, prehashed: 5945 ms cfoa: 4681 ms cfoa, tbb::spin_rw_mutex: 5218 ms cfoa, std::shared_mutex: 4949 ms foa::concurrent_table: 4708 ms tbb::concurrent_hash_map: 7514 ms gtl::parallel_flat_hash_map: 7738 ms gtl::parallel_flat_hash_map: 19315 ms gtl::parallel_flat_hash_map: 10358 ms ``` ### Clang 12, x64 ``` main.cpp Number of threads: 16 boost::unordered_flat_map, single threaded: 9268 ms boost::unordered_flat_map, single threaded, shared_mutex: 13007 ms boost::unordered_flat_map, single threaded, rw_spinlock: 10309 ms cfoa, single threaded: 12697 ms cfoa, tbb::spin_rw_mutex, single threaded: 12760 ms cfoa, std::shared_mutex, single threaded: 14671 ms foa::concurrent_table, single threaded: 12544 ms tbb::concurrent_hash_map, single threaded: 23111 ms boost::unordered_flat_map, sharded_prehashed: 6184 ms boost::unordered_flat_map, sharded_prehashed: 16388 ms boost::unordered_flat_map, sharded_prehashed: 7173 ms boost::unordered_flat_map, sharded isolated, prehashed: 6462 ms cfoa: 5147 ms cfoa, tbb::spin_rw_mutex: 4769 ms cfoa, std::shared_mutex: 5240 ms foa::concurrent_table: 5224 ms tbb::concurrent_hash_map: 7655 ms gtl::parallel_flat_hash_map: 8070 ms gtl::parallel_flat_hash_map: 20963 ms gtl::parallel_flat_hash_map: 12496 ms ``` ### Visual Studio 2019, x64 ``` main.cpp Number of threads: 4 boost::unordered_flat_map, single threaded: 21701 ms boost::unordered_flat_map, single threaded, shared_mutex: 24635 ms boost::unordered_flat_map, single threaded, rw_spinlock: 23425 ms cfoa, single threaded: 24665 ms cfoa, tbb::spin_rw_mutex, single threaded: 25138 ms cfoa, std::shared_mutex, single threaded: 25733 ms foa::concurrent_table, single threaded: 25863 ms tbb::concurrent_hash_map, single threaded: 43211 ms boost::unordered_flat_map, sharded_prehashed: 11415 ms boost::unordered_flat_map, sharded_prehashed: 8909 ms boost::unordered_flat_map, sharded_prehashed: 9669 ms boost::unordered_flat_map, sharded isolated, prehashed: 10088 ms cfoa: 8909 ms cfoa, tbb::spin_rw_mutex: 8853 ms cfoa, std::shared_mutex: 9484 ms foa::concurrent_table: 9606 ms tbb::concurrent_hash_map: 14403 ms gtl::parallel_flat_hash_map: 12691 ms gtl::parallel_flat_hash_map: 10430 ms gtl::parallel_flat_hash_map: 11996 ms ``` ### Clang 12, ARM64 ``` main.cpp Number of threads: 8 boost::unordered_flat_map, single threaded: 6353 ms boost::unordered_flat_map, single threaded, shared_mutex: 10193 ms boost::unordered_flat_map, single threaded, rw_spinlock: 6057 ms cfoa, single threaded: 7541 ms cfoa, tbb::spin_rw_mutex, single threaded: 7604 ms cfoa, std::shared_mutex, single threaded: 11616 ms foa::concurrent_table, single threaded: 7302 ms tbb::concurrent_hash_map, single threaded: 17401 ms boost::unordered_flat_map, sharded_prehashed: 5290 ms boost::unordered_flat_map, sharded_prehashed: 11298 ms boost::unordered_flat_map, sharded_prehashed: 3462 ms boost::unordered_flat_map, sharded isolated, prehashed: 4546 ms cfoa: 3680 ms cfoa, tbb::spin_rw_mutex: 3665 ms cfoa, std::shared_mutex: 4689 ms foa::concurrent_table: 4003 ms tbb::concurrent_hash_map: 5327 ms gtl::parallel_flat_hash_map: 6164 ms gtl::parallel_flat_hash_map: 11437 ms gtl::parallel_flat_hash_map: 3749 ms ``` ### GCC 11, x86 ``` main.cpp Number of threads: 16 boost::unordered_flat_map, single threaded: 1046 ms boost::unordered_flat_map, single threaded, shared_mutex: 1507 ms boost::unordered_flat_map, single threaded, rw_spinlock: 1127 ms cfoa, single threaded: 1518 ms cfoa, tbb::spin_rw_mutex, single threaded: 1533 ms cfoa, std::shared_mutex, single threaded: 1793 ms foa::concurrent_table, single threaded: 1509 ms tbb::concurrent_hash_map, single threaded: 2250 ms boost::unordered_flat_map, sharded_prehashed: 759 ms boost::unordered_flat_map, sharded_prehashed: 1420 ms boost::unordered_flat_map, sharded_prehashed: 610 ms boost::unordered_flat_map, sharded isolated, prehashed: 764 ms cfoa: 799 ms cfoa, tbb::spin_rw_mutex: 869 ms cfoa, std::shared_mutex: 820 ms foa::concurrent_table: 768 ms tbb::concurrent_hash_map: 853 ms gtl::parallel_flat_hash_map: 1108 ms gtl::parallel_flat_hash_map: 1350 ms gtl::parallel_flat_hash_map: 975 ms ``` ### Clang 12, x86 ``` main.cpp Number of threads: 16 boost::unordered_flat_map, single threaded: 1130 ms boost::unordered_flat_map, single threaded, shared_mutex: 1554 ms boost::unordered_flat_map, single threaded, rw_spinlock: 1231 ms cfoa, single threaded: 1480 ms cfoa, tbb::spin_rw_mutex, single threaded: 1485 ms cfoa, std::shared_mutex, single threaded: 1788 ms foa::concurrent_table, single threaded: 1467 ms tbb::concurrent_hash_map, single threaded: 2390 ms boost::unordered_flat_map, sharded_prehashed: 751 ms boost::unordered_flat_map, sharded_prehashed: 1026 ms boost::unordered_flat_map, sharded_prehashed: 669 ms boost::unordered_flat_map, sharded isolated, prehashed: 794 ms cfoa: 877 ms cfoa, tbb::spin_rw_mutex: 776 ms cfoa, std::shared_mutex: 776 ms foa::concurrent_table: 763 ms tbb::concurrent_hash_map: 880 ms gtl::parallel_flat_hash_map: 1006 ms gtl::parallel_flat_hash_map: 1404 ms gtl::parallel_flat_hash_map: 855 ms ``` ### Visual Studio 2019, x86 ``` main.cpp Number of threads: 4 boost::unordered_flat_map, single threaded: 1347 ms boost::unordered_flat_map, single threaded, shared_mutex: 1681 ms boost::unordered_flat_map, single threaded, rw_spinlock: 1483 ms cfoa, single threaded: 2039 ms cfoa, tbb::spin_rw_mutex, single threaded: 2043 ms cfoa, std::shared_mutex, single threaded: 2278 ms foa::concurrent_table, single threaded: 1975 ms tbb::concurrent_hash_map, single threaded: 4263 ms boost::unordered_flat_map, sharded_prehashed: 1013 ms boost::unordered_flat_map, sharded_prehashed: 778 ms boost::unordered_flat_map, sharded_prehashed: 801 ms boost::unordered_flat_map, sharded isolated, prehashed: 1108 ms cfoa: 813 ms cfoa, tbb::spin_rw_mutex: 772 ms cfoa, std::shared_mutex: 860 ms foa::concurrent_table: 842 ms tbb::concurrent_hash_map: 1412 ms gtl::parallel_flat_hash_map: 1175 ms gtl::parallel_flat_hash_map: 936 ms gtl::parallel_flat_hash_map: 900 ms ```