greyblake / whatlang-rs

Natural language detection library for Rust. Try demo online: https://whatlang.org/
https://whatlang.org/
MIT License
966 stars 108 forks source link

Get rid of hashbrown depdency #48

Closed greyblake closed 4 years ago

greyblake commented 4 years ago

Because now it's the default HashMap in std: https://blog.rust-lang.org/2019/07/04/Rust-1.36.0.html#a-new-hashmapk,-v%3E-implementation

greyblake commented 4 years ago

With hashbrown::HashMap:

test bench_detect        ... bench:  20,047,742 ns/iter (+/- 907,381)
test bench_detect_script ... bench:     284,873 ns/iter (+/- 21,324)

With std::collections::HashMap

test bench_detect        ... bench:  30,486,364 ns/iter (+/- 1,019,361)
test bench_detect_script ... bench:     285,050 ns/iter (+/- 17,296)

std::collections::HashMap is 50% slower, because it uses SipHash 1-3 hashing algorithm by default. hashbrown uses AHash.