# 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: 8123 ms boost::unordered_flat_map, single threaded, shared_mutex: 11980 ms boost::unordered_flat_map, single threaded, rw_spinlock: 9591 ms cfoa, single threaded: 12973 ms cfoa, tbb::spin_rw_mutex, single threaded: 12812 ms cfoa, std::shared_mutex, single threaded: 15221 ms foa::concurrent_table, single threaded: 12500 ms tbb::concurrent_hash_map, single threaded: 22621 ms boost::unordered_flat_map, sharded_prehashed: 6531 ms boost::unordered_flat_map, sharded_prehashed: 17261 ms boost::unordered_flat_map, sharded_prehashed: 7188 ms boost::unordered_flat_map, sharded isolated, prehashed: 5826 ms cfoa: 4562 ms cfoa, tbb::spin_rw_mutex: 5036 ms cfoa, std::shared_mutex: 5005 ms foa::concurrent_table: 4854 ms tbb::concurrent_hash_map: 7601 ms gtl::parallel_flat_hash_map: 7825 ms gtl::parallel_flat_hash_map: 17471 ms gtl::parallel_flat_hash_map: 10534 ms ``` ### Clang 12, x64 ``` main.cpp Number of threads: 16 boost::unordered_flat_map, single threaded: 9321 ms boost::unordered_flat_map, single threaded, shared_mutex: 12907 ms boost::unordered_flat_map, single threaded, rw_spinlock: 10282 ms cfoa, single threaded: 12685 ms cfoa, tbb::spin_rw_mutex, single threaded: 12726 ms cfoa, std::shared_mutex, single threaded: 14640 ms foa::concurrent_table, single threaded: 12653 ms tbb::concurrent_hash_map, single threaded: 23179 ms boost::unordered_flat_map, sharded_prehashed: 6298 ms boost::unordered_flat_map, sharded_prehashed: 13168 ms boost::unordered_flat_map, sharded_prehashed: 7136 ms boost::unordered_flat_map, sharded isolated, prehashed: 6253 ms cfoa: 4639 ms cfoa, tbb::spin_rw_mutex: 4631 ms cfoa, std::shared_mutex: 5030 ms foa::concurrent_table: 4845 ms tbb::concurrent_hash_map: 7591 ms gtl::parallel_flat_hash_map: 8001 ms gtl::parallel_flat_hash_map: 21080 ms gtl::parallel_flat_hash_map: 12299 ms ``` ### Visual Studio 2019, x64 ``` main.cpp Number of threads: 4 boost::unordered_flat_map, single threaded: 20845 ms boost::unordered_flat_map, single threaded, shared_mutex: 24719 ms boost::unordered_flat_map, single threaded, rw_spinlock: 23512 ms cfoa, single threaded: 24714 ms cfoa, tbb::spin_rw_mutex, single threaded: 25005 ms cfoa, std::shared_mutex, single threaded: 25030 ms foa::concurrent_table, single threaded: 24899 ms tbb::concurrent_hash_map, single threaded: 42639 ms boost::unordered_flat_map, sharded_prehashed: 11003 ms boost::unordered_flat_map, sharded_prehashed: 8981 ms boost::unordered_flat_map, sharded_prehashed: 9674 ms boost::unordered_flat_map, sharded isolated, prehashed: 10419 ms cfoa: 8703 ms cfoa, tbb::spin_rw_mutex: 8715 ms cfoa, std::shared_mutex: 9125 ms foa::concurrent_table: 8435 ms tbb::concurrent_hash_map: 14504 ms gtl::parallel_flat_hash_map: 11828 ms gtl::parallel_flat_hash_map: 10025 ms gtl::parallel_flat_hash_map: 11966 ms ``` ### Clang 12, ARM64 ``` main.cpp Number of threads: 8 boost::unordered_flat_map, single threaded: 6278 ms boost::unordered_flat_map, single threaded, shared_mutex: 10161 ms boost::unordered_flat_map, single threaded, rw_spinlock: 6040 ms cfoa, single threaded: 7562 ms cfoa, tbb::spin_rw_mutex, single threaded: 7574 ms cfoa, std::shared_mutex, single threaded: 11644 ms foa::concurrent_table, single threaded: 7414 ms tbb::concurrent_hash_map, single threaded: 17341 ms boost::unordered_flat_map, sharded_prehashed: 5322 ms boost::unordered_flat_map, sharded_prehashed: 11455 ms boost::unordered_flat_map, sharded_prehashed: 3450 ms boost::unordered_flat_map, sharded isolated, prehashed: 4538 ms cfoa: 3642 ms cfoa, tbb::spin_rw_mutex: 3736 ms cfoa, std::shared_mutex: 4565 ms foa::concurrent_table: 3796 ms tbb::concurrent_hash_map: 5387 ms gtl::parallel_flat_hash_map: 6294 ms gtl::parallel_flat_hash_map: 11378 ms gtl::parallel_flat_hash_map: 3751 ms ``` ### GCC 11, x86 ``` main.cpp Number of threads: 16 boost::unordered_flat_map, single threaded: 1058 ms boost::unordered_flat_map, single threaded, shared_mutex: 1488 ms boost::unordered_flat_map, single threaded, rw_spinlock: 1141 ms cfoa, single threaded: 1506 ms cfoa, tbb::spin_rw_mutex, single threaded: 1514 ms cfoa, std::shared_mutex, single threaded: 1781 ms foa::concurrent_table, single threaded: 1525 ms tbb::concurrent_hash_map, single threaded: 2264 ms boost::unordered_flat_map, sharded_prehashed: 780 ms boost::unordered_flat_map, sharded_prehashed: 1528 ms boost::unordered_flat_map, sharded_prehashed: 835 ms boost::unordered_flat_map, sharded isolated, prehashed: 748 ms cfoa: 682 ms cfoa, tbb::spin_rw_mutex: 691 ms cfoa, std::shared_mutex: 744 ms foa::concurrent_table: 798 ms tbb::concurrent_hash_map: 851 ms gtl::parallel_flat_hash_map: 1101 ms gtl::parallel_flat_hash_map: 4814 ms gtl::parallel_flat_hash_map: 984 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: 1557 ms boost::unordered_flat_map, single threaded, rw_spinlock: 1231 ms cfoa, single threaded: 1440 ms cfoa, tbb::spin_rw_mutex, single threaded: 1453 ms cfoa, std::shared_mutex, single threaded: 1766 ms foa::concurrent_table, single threaded: 1456 ms tbb::concurrent_hash_map, single threaded: 2369 ms boost::unordered_flat_map, sharded_prehashed: 731 ms boost::unordered_flat_map, sharded_prehashed: 1485 ms boost::unordered_flat_map, sharded_prehashed: 796 ms boost::unordered_flat_map, sharded isolated, prehashed: 793 ms cfoa: 615 ms cfoa, tbb::spin_rw_mutex: 631 ms cfoa, std::shared_mutex: 723 ms foa::concurrent_table: 762 ms tbb::concurrent_hash_map: 878 ms gtl::parallel_flat_hash_map: 1007 ms gtl::parallel_flat_hash_map: 2190 ms gtl::parallel_flat_hash_map: 1459 ms ``` ### Visual Studio 2019, x86 ``` main.cpp Number of threads: 4 boost::unordered_flat_map, single threaded: 1313 ms boost::unordered_flat_map, single threaded, shared_mutex: 1822 ms boost::unordered_flat_map, single threaded, rw_spinlock: 1495 ms cfoa, single threaded: 1997 ms cfoa, tbb::spin_rw_mutex, single threaded: 2085 ms cfoa, std::shared_mutex, single threaded: 2293 ms foa::concurrent_table, single threaded: 1891 ms tbb::concurrent_hash_map, single threaded: 3810 ms boost::unordered_flat_map, sharded_prehashed: 1030 ms boost::unordered_flat_map, sharded_prehashed: 819 ms boost::unordered_flat_map, sharded_prehashed: 738 ms boost::unordered_flat_map, sharded isolated, prehashed: 867 ms cfoa: 769 ms cfoa, tbb::spin_rw_mutex: 828 ms cfoa, std::shared_mutex: 885 ms foa::concurrent_table: 778 ms tbb::concurrent_hash_map: 1248 ms gtl::parallel_flat_hash_map: 994 ms gtl::parallel_flat_hash_map: 945 ms gtl::parallel_flat_hash_map: 752 ms ```