# 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: 7764 ms boost::unordered_flat_map, single threaded, shared_mutex: 11723 ms boost::unordered_flat_map, single threaded, rw_spinlock: 9299 ms cfoa, single threaded: 12706 ms cfoa, tbb::spin_rw_mutex, single threaded: 12473 ms cfoa, std::shared_mutex, single threaded: 14272 ms foa::concurrent_table, single threaded: 12244 ms tbb::concurrent_hash_map, single threaded: 21948 ms boost::unordered_flat_map, sharded_prehashed: 6547 ms boost::unordered_flat_map, sharded_prehashed: 21602 ms boost::unordered_flat_map, sharded_prehashed: 7199 ms boost::unordered_flat_map, sharded isolated, prehashed: 5670 ms cfoa: 4707 ms cfoa, tbb::spin_rw_mutex: 4492 ms cfoa, std::shared_mutex: 4788 ms foa::concurrent_table: 4825 ms tbb::concurrent_hash_map: 7503 ms gtl::parallel_flat_hash_map: 7832 ms gtl::parallel_flat_hash_map: 18041 ms gtl::parallel_flat_hash_map: 9865 ms ``` ### Clang 12, x64 ``` main.cpp Number of threads: 16 boost::unordered_flat_map, single threaded: 9246 ms boost::unordered_flat_map, single threaded, shared_mutex: 12883 ms boost::unordered_flat_map, single threaded, rw_spinlock: 10268 ms cfoa, single threaded: 12653 ms cfoa, tbb::spin_rw_mutex, single threaded: 12685 ms cfoa, std::shared_mutex, single threaded: 14796 ms foa::concurrent_table, single threaded: 12656 ms tbb::concurrent_hash_map, single threaded: 23192 ms boost::unordered_flat_map, sharded_prehashed: 6247 ms boost::unordered_flat_map, sharded_prehashed: 17364 ms boost::unordered_flat_map, sharded_prehashed: 7104 ms boost::unordered_flat_map, sharded isolated, prehashed: 6013 ms cfoa: 5081 ms cfoa, tbb::spin_rw_mutex: 4701 ms cfoa, std::shared_mutex: 5042 ms foa::concurrent_table: 4868 ms tbb::concurrent_hash_map: 7555 ms gtl::parallel_flat_hash_map: 8019 ms gtl::parallel_flat_hash_map: 18928 ms gtl::parallel_flat_hash_map: 11672 ms ``` ### Visual Studio 2019, x64 ``` main.cpp Number of threads: 4 boost::unordered_flat_map, single threaded: 23200 ms boost::unordered_flat_map, single threaded, shared_mutex: 26625 ms boost::unordered_flat_map, single threaded, rw_spinlock: 24937 ms cfoa, single threaded: 24846 ms cfoa, tbb::spin_rw_mutex, single threaded: 25196 ms cfoa, std::shared_mutex, single threaded: 25287 ms foa::concurrent_table, single threaded: 24834 ms tbb::concurrent_hash_map, single threaded: 42615 ms boost::unordered_flat_map, sharded_prehashed: 11761 ms boost::unordered_flat_map, sharded_prehashed: 9192 ms boost::unordered_flat_map, sharded_prehashed: 9757 ms boost::unordered_flat_map, sharded isolated, prehashed: 10396 ms cfoa: 8905 ms cfoa, tbb::spin_rw_mutex: 9047 ms cfoa, std::shared_mutex: 8979 ms foa::concurrent_table: 8983 ms tbb::concurrent_hash_map: 14221 ms gtl::parallel_flat_hash_map: 12374 ms gtl::parallel_flat_hash_map: 10359 ms gtl::parallel_flat_hash_map: 11724 ms ``` ### Clang 12, ARM64 ``` main.cpp Number of threads: 8 boost::unordered_flat_map, single threaded: 6371 ms boost::unordered_flat_map, single threaded, shared_mutex: 10151 ms boost::unordered_flat_map, single threaded, rw_spinlock: 6049 ms cfoa, single threaded: 7514 ms cfoa, tbb::spin_rw_mutex, single threaded: 7563 ms cfoa, std::shared_mutex, single threaded: 11613 ms foa::concurrent_table, single threaded: 7445 ms tbb::concurrent_hash_map, single threaded: 17365 ms boost::unordered_flat_map, sharded_prehashed: 5320 ms boost::unordered_flat_map, sharded_prehashed: 11232 ms boost::unordered_flat_map, sharded_prehashed: 3439 ms boost::unordered_flat_map, sharded isolated, prehashed: 4478 ms cfoa: 3777 ms cfoa, tbb::spin_rw_mutex: 3665 ms cfoa, std::shared_mutex: 4695 ms foa::concurrent_table: 3707 ms tbb::concurrent_hash_map: 5369 ms gtl::parallel_flat_hash_map: 6271 ms gtl::parallel_flat_hash_map: 11372 ms gtl::parallel_flat_hash_map: 3750 ms ``` ### GCC 11, x86 ``` main.cpp Number of threads: 16 boost::unordered_flat_map, single threaded: 1044 ms boost::unordered_flat_map, single threaded, shared_mutex: 1475 ms boost::unordered_flat_map, single threaded, rw_spinlock: 1127 ms cfoa, single threaded: 1486 ms cfoa, tbb::spin_rw_mutex, single threaded: 1509 ms cfoa, std::shared_mutex, single threaded: 1764 ms foa::concurrent_table, single threaded: 1489 ms tbb::concurrent_hash_map, single threaded: 2236 ms boost::unordered_flat_map, sharded_prehashed: 752 ms boost::unordered_flat_map, sharded_prehashed: 1105 ms boost::unordered_flat_map, sharded_prehashed: 680 ms boost::unordered_flat_map, sharded isolated, prehashed: 753 ms cfoa: 661 ms cfoa, tbb::spin_rw_mutex: 687 ms cfoa, std::shared_mutex: 716 ms foa::concurrent_table: 867 ms tbb::concurrent_hash_map: 876 ms gtl::parallel_flat_hash_map: 1113 ms gtl::parallel_flat_hash_map: 3199 ms gtl::parallel_flat_hash_map: 986 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: 1328 ms boost::unordered_flat_map, single threaded, shared_mutex: 1821 ms boost::unordered_flat_map, single threaded, rw_spinlock: 1559 ms cfoa, single threaded: 2061 ms cfoa, tbb::spin_rw_mutex, single threaded: 2032 ms cfoa, std::shared_mutex, single threaded: 2262 ms foa::concurrent_table, single threaded: 2090 ms tbb::concurrent_hash_map, single threaded: 4097 ms boost::unordered_flat_map, sharded_prehashed: 1014 ms boost::unordered_flat_map, sharded_prehashed: 805 ms boost::unordered_flat_map, sharded_prehashed: 736 ms boost::unordered_flat_map, sharded isolated, prehashed: 980 ms cfoa: 686 ms cfoa, tbb::spin_rw_mutex: 788 ms cfoa, std::shared_mutex: 891 ms foa::concurrent_table: 845 ms tbb::concurrent_hash_map: 1316 ms gtl::parallel_flat_hash_map: 1177 ms gtl::parallel_flat_hash_map: 898 ms gtl::parallel_flat_hash_map: 863 ms ```