[PATCH] D21510: [libc++] Check hash before calling __hash_table key_eq function

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 29 23:15:10 PDT 2016

EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

LGTM. I benchmarked the change against different key types and:

1. The change doesn't have a large detrimental impact when the key equality is as expensive as hash equality. I benchmarked std::unordered_set<int>.find(...) at 27ns and 29ns before and after the change for a load factor >= 3.5, and 15ns vs 17 ns when the load factor is less than one.

2. The change has a large positive impact when the load factor is > 1 and where key equality is more expensive than hash equality. For strings of size 1024 that only differed in the last characters I noticed a change of 880ns to 650ns. for a load factor >= 3.5.

3. This change has a slight positive inpact when the load factor is < 1. For the same string inputs (mentioned above)  I  saw timings of 661ns and 623ns before and after.



More information about the cfe-commits mailing list