maciejhirsz / ramhorns

Fast Mustache template engine implementation in pure Rust.
https://crates.io/crates/ramhorns
Mozilla Public License 2.0
293 stars 29 forks source link

benchmark with fxhash #61

Closed godofdream closed 1 year ago

godofdream commented 2 years ago

ramhorns uses fnvhash as default, however the hasher is interchangeable. Could you add a benchmark with https://github.com/cbreeden/fxhash ? you have mentioned fxhash as faster alternative in https://maciej.codes/2019-03-03-ramhorns.html

maciejhirsz commented 2 years ago

ramhorns uses fnvhash as default, however the hasher is interchangeable.

You can only change the hasher used for internal hashmap that handles partials. All regular variable injection is hardcoded to fnv, and there is no way to change it with generics since the hash has to match the output of the derive macro.

FxHash produces collisions on English word dictionaries, where as 64bit fnv does not, so any performance gains there would be void if we had to compare strings by value to get rid of collisions.

godofdream commented 1 year ago

I was able to reproduce hash collisions with fxhash