# 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: 7780 ms boost::unordered_flat_map, single threaded, shared_mutex: 11729 ms boost::unordered_flat_map, single threaded, rw_spinlock: 9262 ms cfoa, single threaded: 12656 ms cfoa, tbb::spin_rw_mutex, single threaded: 12448 ms cfoa, std::shared_mutex, single threaded: 14168 ms foa::concurrent_table, single threaded: 12277 ms tbb::concurrent_hash_map, single threaded: 21945 ms boost::unordered_flat_map, sharded_prehashed: 6476 ms boost::unordered_flat_map, sharded_prehashed: 14142 ms boost::unordered_flat_map, sharded_prehashed: 7390 ms boost::unordered_flat_map, sharded isolated, prehashed: 5905 ms cfoa: 4721 ms cfoa, tbb::spin_rw_mutex: 4661 ms cfoa, std::shared_mutex: 5008 ms foa::concurrent_table: 4586 ms tbb::concurrent_hash_map: 7288 ms gtl::parallel_flat_hash_map: 7727 ms gtl::parallel_flat_hash_map: 15530 ms gtl::parallel_flat_hash_map: 10579 ms ``` ### Clang 12, x64 ``` main.cpp Number of threads: 16 boost::unordered_flat_map, single threaded: 9291 ms boost::unordered_flat_map, single threaded, shared_mutex: 12982 ms boost::unordered_flat_map, single threaded, rw_spinlock: 10303 ms cfoa, single threaded: 12734 ms cfoa, tbb::spin_rw_mutex, single threaded: 12825 ms cfoa, std::shared_mutex, single threaded: 14723 ms foa::concurrent_table, single threaded: 12682 ms tbb::concurrent_hash_map, single threaded: 23287 ms boost::unordered_flat_map, sharded_prehashed: 6212 ms boost::unordered_flat_map, sharded_prehashed: 15098 ms boost::unordered_flat_map, sharded_prehashed: 7167 ms boost::unordered_flat_map, sharded isolated, prehashed: 6630 ms cfoa: 5120 ms cfoa, tbb::spin_rw_mutex: 4914 ms cfoa, std::shared_mutex: 5380 ms foa::concurrent_table: 5110 ms tbb::concurrent_hash_map: 7453 ms gtl::parallel_flat_hash_map: 8079 ms gtl::parallel_flat_hash_map: 24494 ms gtl::parallel_flat_hash_map: 11851 ms ``` ### Visual Studio 2019, x64 ``` main.cpp Number of threads: 4 boost::unordered_flat_map, single threaded: 24792 ms boost::unordered_flat_map, single threaded, shared_mutex: 26899 ms boost::unordered_flat_map, single threaded, rw_spinlock: 26172 ms cfoa, single threaded: 24912 ms cfoa, tbb::spin_rw_mutex, single threaded: 26188 ms cfoa, std::shared_mutex, single threaded: 25578 ms foa::concurrent_table, single threaded: 24792 ms tbb::concurrent_hash_map, single threaded: 42513 ms boost::unordered_flat_map, sharded_prehashed: 11039 ms boost::unordered_flat_map, sharded_prehashed: 8736 ms boost::unordered_flat_map, sharded_prehashed: 9890 ms boost::unordered_flat_map, sharded isolated, prehashed: 10258 ms cfoa: 9027 ms cfoa, tbb::spin_rw_mutex: 9166 ms cfoa, std::shared_mutex: 9033 ms foa::concurrent_table: 8625 ms tbb::concurrent_hash_map: 14020 ms gtl::parallel_flat_hash_map: 12600 ms gtl::parallel_flat_hash_map: 10293 ms gtl::parallel_flat_hash_map: 11587 ms ``` ### Clang 12, ARM64 ``` main.cpp Number of threads: 8 boost::unordered_flat_map, single threaded: 5888 ms boost::unordered_flat_map, single threaded, shared_mutex: 10235 ms boost::unordered_flat_map, single threaded, rw_spinlock: 6079 ms cfoa, single threaded: 7525 ms cfoa, tbb::spin_rw_mutex, single threaded: 7620 ms cfoa, std::shared_mutex, single threaded: 11628 ms foa::concurrent_table, single threaded: 7401 ms tbb::concurrent_hash_map, single threaded: 17496 ms boost::unordered_flat_map, sharded_prehashed: 5281 ms boost::unordered_flat_map, sharded_prehashed: 11502 ms boost::unordered_flat_map, sharded_prehashed: 3389 ms boost::unordered_flat_map, sharded isolated, prehashed: 4595 ms cfoa: 3605 ms cfoa, tbb::spin_rw_mutex: 3764 ms cfoa, std::shared_mutex: 4730 ms foa::concurrent_table: 3615 ms tbb::concurrent_hash_map: 5311 ms gtl::parallel_flat_hash_map: 6358 ms gtl::parallel_flat_hash_map: 11410 ms gtl::parallel_flat_hash_map: 3764 ms ``` ### GCC 11, x86 ``` main.cpp Number of threads: 16 boost::unordered_flat_map, single threaded: 1057 ms boost::unordered_flat_map, single threaded, shared_mutex: 1501 ms boost::unordered_flat_map, single threaded, rw_spinlock: 1135 ms cfoa, single threaded: 1519 ms cfoa, tbb::spin_rw_mutex, single threaded: 1534 ms cfoa, std::shared_mutex, single threaded: 1835 ms foa::concurrent_table, single threaded: 1512 ms tbb::concurrent_hash_map, single threaded: 2276 ms boost::unordered_flat_map, sharded_prehashed: 758 ms boost::unordered_flat_map, sharded_prehashed: 1359 ms boost::unordered_flat_map, sharded_prehashed: 602 ms boost::unordered_flat_map, sharded isolated, prehashed: 790 ms cfoa: 825 ms cfoa, tbb::spin_rw_mutex: 938 ms cfoa, std::shared_mutex: 830 ms foa::concurrent_table: 867 ms tbb::concurrent_hash_map: 861 ms gtl::parallel_flat_hash_map: 1109 ms gtl::parallel_flat_hash_map: 3413 ms gtl::parallel_flat_hash_map: 970 ms ``` ### Clang 12, x86 ``` main.cpp Number of threads: 16 boost::unordered_flat_map, single threaded: 1144 ms boost::unordered_flat_map, single threaded, shared_mutex: 1563 ms boost::unordered_flat_map, single threaded, rw_spinlock: 1228 ms cfoa, single threaded: 1476 ms cfoa, tbb::spin_rw_mutex, single threaded: 1487 ms cfoa, std::shared_mutex, single threaded: 1793 ms foa::concurrent_table, single threaded: 1452 ms tbb::concurrent_hash_map, single threaded: 2365 ms boost::unordered_flat_map, sharded_prehashed: 746 ms boost::unordered_flat_map, sharded_prehashed: 1566 ms boost::unordered_flat_map, sharded_prehashed: 695 ms boost::unordered_flat_map, sharded isolated, prehashed: 770 ms cfoa: 816 ms cfoa, tbb::spin_rw_mutex: 796 ms cfoa, std::shared_mutex: 805 ms foa::concurrent_table: 840 ms tbb::concurrent_hash_map: 872 ms gtl::parallel_flat_hash_map: 1011 ms gtl::parallel_flat_hash_map: 2578 ms gtl::parallel_flat_hash_map: 982 ms ``` ### Visual Studio 2019, x86 ``` main.cpp Number of threads: 4 boost::unordered_flat_map, single threaded: 1355 ms boost::unordered_flat_map, single threaded, shared_mutex: 1781 ms boost::unordered_flat_map, single threaded, rw_spinlock: 1591 ms cfoa, single threaded: 2121 ms cfoa, tbb::spin_rw_mutex, single threaded: 2087 ms cfoa, std::shared_mutex, single threaded: 2292 ms foa::concurrent_table, single threaded: 2065 ms tbb::concurrent_hash_map, single threaded: 4062 ms boost::unordered_flat_map, sharded_prehashed: 940 ms boost::unordered_flat_map, sharded_prehashed: 788 ms boost::unordered_flat_map, sharded_prehashed: 782 ms boost::unordered_flat_map, sharded isolated, prehashed: 936 ms cfoa: 814 ms cfoa, tbb::spin_rw_mutex: 867 ms cfoa, std::shared_mutex: 968 ms foa::concurrent_table: 865 ms tbb::concurrent_hash_map: 1506 ms gtl::parallel_flat_hash_map: 1054 ms gtl::parallel_flat_hash_map: 952 ms gtl::parallel_flat_hash_map: 910 ms ```