Closed FilipAndersson245 closed 1 year ago
I did a very basic performance comparason using the fib example, using hyperfine
❯ hyperfine --warmup 50 --runs 1000 --shell none './fib' './fib-ahash'
Benchmark 1: ./fib
Time (mean ± σ): 5.6 ms ± 1.1 ms [User: 4.5 ms, System: 1.1 ms]
Range (min … max): 4.5 ms … 13.1 ms 1000 runs
Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.
Benchmark 2: ./fib-ahash
Time (mean ± σ): 5.2 ms ± 1.2 ms [User: 4.0 ms, System: 1.2 ms]
Range (min … max): 3.8 ms … 9.3 ms 1000 runs
Summary
./fib-ahash ran
1.08 ± 0.33 times faster than ./fib
@jaemk anything else that has to be done to merge this PR?
@FilipAndersson245 sorry for the delay, thank you for adding this! I'll merge and release later today
@FilipAndersson245 sorry for the delay, thank you for adding this! I'll merge and release later today
no problem 😄 What would be your thoughts on making this part of the default? it would not increase compile time as its part of hashbrowns already and has some neat perf improvement.
I'm on board with making it the default hash algo. Can you also update the crate-level docs explaining that it's the default
I'm on board with making it the default hash algo. Can you also update the crate-level docs explaining that it's the default
done
@FilipAndersson245 would you mind running make docs
and pulling in changes from master
Hello had to do some rebasing of the commits everything should be fine now I believe.
This PR adds a new feature
ahash
that changes primarily what hashing algorithm is used to hash data, instead opting for the fasterahash
algorithm. It also changes the hashtable implementation instead to be directly depending onhashbrown
for sized we already depended directly onhashbrown
so there the only change is theahash
hashing compared to the default. The default inhashbrown
is to useahash
so for the other ones I opted just to usehashbrown
directly. Maybe this could even be simplified as we could usehashbrown
everywhere.✅cargo fmt ✅update changelog