ogxd / gxhash

The fastest hashing algorithm 📈
https://docs.rs/gxhash
MIT License
700 stars 23 forks source link

Don't finalize in Hasher::write, but in finish instead #17

Closed ogxd closed 8 months ago

ogxd commented 8 months ago

Context

Currently, each Hasher::write implies a finalization. This is a problem because hashing strings for instance needs 2 writes (see write_str implementation), thus 2 finalization steps, which is the most expensive part of the hashing process.

Todo

Only finalize in finish

ogxd commented 8 months ago

This has involved a stability breaking change, so SMHasher tests must be reevaluated before merging

ogxd commented 8 months ago

Ok I am not sure why but stability is unchanged. Since the algorithm stability is unaffected and the public API is unchanged, I am versioning this as a patch.