robin-hood-hashing icon indicating copy to clipboard operation
robin-hood-hashing copied to clipboard

linux performance is not as good as windows

Open qdztxc opened this issue 3 years ago • 4 comments

I do benchmark with robin_hood, tsl, ska hashmaps, include insert/delete/find/not_find cases. robin_hood is overally the best under windows platform (i7 11700k, win11). It's slightly faster than tsk and ska. The result is almost the same as https://martin.ankerl.com/2019/04/01/hashmap-benchmarks-04-04-result-RandomFindString/

But when I run the same benchmark under linux, robin_hood is two timers slower than tsl and ska. Both gcc and clang compiler with O3 optimization flag. I glanced over robin_hood source code and didn't find any hint why it's slower under linux. Any idea about this?

Thanks and regards.

qdztxc avatar Jan 20 '22 00:01 qdztxc

I tried windows platform + clang compiler. robin_hood performs as fast as MSVC. The performance dropdown of linux seems casued by OS instead of compiler.

qdztxc avatar Jan 20 '22 08:01 qdztxc

I have tried Windows/MSVC vs Apple/Clang on machines with similar processors, and Clang wins always (sometimes a lot). Worth noting: ska hashmaps beat robin_hood almost always. I guess (?) thanks to the Fibonacci hashing which is being used (https://probablydance.com/2018/06/16/fibonacci-hashing-the-optimization-that-the-world-forgot-or-a-better-alternative-to-integer-modulo/)

Philippe91 avatar Jan 23 '22 18:01 Philippe91

I tried windows platform + clang compiler. robin_hood performs as fast as MSVC. The performance dropdown of linux seems casued by OS instead of compiler.

you can try my bench https://github.com/ktprime/emhash/blob/master/bench/martin_bench.cpp . the code is copy from martinus's git and the result is easy benched and comparison. the result is also quite different martinus's result(depends on hash function + cpu + compiler + case).

ktprime avatar Feb 13 '22 12:02 ktprime

I have tried Windows/MSVC vs Apple/Clang on machines with similar processors, and Clang wins always (sometimes a lot). Worth noting: ska hashmaps beat robin_hood almost always. I guess (?) thanks to the Fibonacci hashing which is being used (https://probablydance.com/2018/06/16/fibonacci-hashing-the-optimization-that-the-world-forgot-or-a-better-alternative-to-integer-modulo/)

default load factor of ska hashmap is 0.5(same as tsl ::robin), so it's fast as you see. I have benched many different third-party flat hash map/benchmark over 3 years(set same load factor). you can test and bench https://github.com/ktprime/emhash/blob/master/bench/ebench.cpp. (6 hash function, more than 10 hash maps, 16 key/value compoision, 3 compliers, 6 cpus, 3 os)

ktprime avatar Feb 13 '22 12:02 ktprime