List of the contestants for the benchmark. Note that some implementations are here multiple times but with a different max load factor. When comparing two hash maps, don't forget to take the load factor into account (it is easier for a hash map with a load factor of 0.2 to be faster than one with 0.9). When hovering over a data point, you will be able to see the load factor of the map for the data point.
Analysis of the data.
The benchmark was compiled with Clang 5.0 and ran on Linux 4.11 x64 with an Intel i5-5200u and 8 Go of RAM.
For the integers tests, we use hash maps with int64_t as key and int64_t as value.
Before the test, we generate a vector with the values [0, nb_entries) and shuffle this vector. Then for each value k in the vector, we insert the key-value pair (k, 1) in the hash map.
Before the test, we generate a vector of nb_entries size where each value is randomly taken from an uniform random number generator from all possible positive values an int64_t can hold. Then for each value k in the vector, we insert the key-value pair (k, 1) in the hash map.
Same as the random full inserts test but the reserve method of the hash map is called beforehand to avoid any rehash during the insertion. It provides a fair comparison even if the growth factor of each hash map is different.
Before the test, we insert nb_entries elements in the same way as in the random full insert test. We then delete each key one by one in a different and random order than the one they were inserted.
Before the test, we insert nb_entries elements in the same way as in the random shuffle inserts test. We then read each key-value pair in a different and random order than the one they were inserted.
Before the test, we insert nb_entries elements in the same way as in the random full inserts test. We then read each key-value pair in a different and random order than the one they were inserted.
Before the test, we insert nb_entries elements in the same way as in the random full inserts test. We then generate another vector of nb_entries random elements different from the inserted elements and we try to search for these unknown elements in the hash map.
Before the test, we insert nb_entries elements in the same way as in the random full inserts test before deleting half of these values randomly. We then try to read all the original values in a different order which will lead to 50% hits and 50% misses.
Before the test, we insert nb_entries elements in the same way as in the random full inserts test. We then use the hash map iterators to read all the key-value pairs.
Before the random full inserts benchmark finishes, we measure the memory that the hash map is using.
Before the random full inserts with reserve benchmark finishes, we measure the memory that the hash map is using. The benchmark is similar to the one above but without measuring the memory fragmentation that the rehash process may cause.
For the small string tests, we use hash maps with std::string as key and int64_t as value.
Each string is a random generated string of 15 alphanumeric characters (+1 for the null terminator). A generated key may look like "ju1AOoeWT3LdJxL".
For each entry in the range [0, nb_entries), we generate a string as key and insert it with the value 1.
Same as the inserts test but the reserve method of the hash map is called beforehand to avoid any rehash during the insertion. It provides a fair comparison even if the growth factor of each hash map is different.
Before the test, we insert nb_entries elements in the hash map as in the inserts test. We then delete each key one by one in a different and random order than the one they were inserted.
Before the test, we insert nb_entries elements in the hash map as in the inserts test. We then read each key-value pair in a different and random order than the one they were inserted.
Before the test, we insert nb_entries elements in the same way as in the inserts test. We then generate nb_entries strings different from the inserted elements and we try to search for these unknown elements in the hash map.
Before the test, we insert nb_entries elements in the same way as in the inserts test before deleting half of these values randomly. We then try to read all the original values in a different order which will lead to 50% hits and 50% misses.
Before the inserts benchmark finishes, we measure the memory that the hash map is using.
Before the inserts with reserve benchmark finishes, we measure the memory that the hash map is using. The benchmark is similar to the one above but without measuring the memory fragmentation that the rehash process may cause.
For the string tests, we use hash maps with std::string as key and int64_t as value.
Each string is a random generated string of 50 alphanumeric characters (+1 for the null terminator). A generated key may look like "nv46iTRp7ur6UMbdgEkCHpoq7Qx7UU9Ta0u1ETdAvUb4LG6Xu6".
For each entry in the range [0, nb_entries), we generate a string as key and insert it with the value 1.
Same as the inserts test but the reserve method of the hash map is called beforehand to avoid any rehash during the insertion. It provides a fair comparison even if the growth factor of each hash map is different.
Before the test, we insert nb_entries elements in the hash map as in the inserts test. We then delete each key one by one in a different and random order than the one they were inserted.
Before the test, we insert nb_entries elements in the hash map as in the inserts test. We then read each key-value pair in a different and random order than the one they were inserted.
Before the test, we insert nb_entries elements in the same way as in the inserts test. We then generate nb_entries strings different from the inserted elements and we try to search for these unknown elements in the hash map.
Before the test, we insert nb_entries elements in the same way as in the inserts test before deleting half of these values randomly. We then try to read all the original values in a different order which will lead to 50% hits and 50% misses.
Before the inserts benchmark finishes, we measure the memory that the hash map is using.
Before the inserts with reserve benchmark finishes, we measure the memory that the hash map is using. The benchmark is similar to the one above but without measuring the memory fragmentation that the rehash process may cause.