brandondahler / Data.HashFunction

C# library to create a common interface to non-cryptographic hash functions.
MIT License
254 stars 42 forks source link

Performance #38

Closed fleed closed 6 years ago

fleed commented 6 years ago

Which is the most perforant algorithm? Is there somewhere a table with measures?

brandondahler commented 6 years ago

There are no benchmarks for the implementations of the hash functions in this library. The primary reason for this is because it is very very difficult to compare hash functions apples to apples while also qualifying how collision resistant and uniformly distributed the values are for different types of inputs.

One of the differences in this library versus others, as discussed in #32, is that our goal isn't necessarily performance but the completeness, cleanliness, consumability, and safety across platform by using fully managed implementations.

In that linked issue, these two things were said, which i think sum it up nicely:

I won't speak for brandon, but I believe our two libraries may have a different focus. Farmhash.Sharp emphasizes speed whereas Data.HashFunction emphasizes completeness, safety, and ergonomics. This is apparent in benchmarks where Farmhash.Sharp exhibits 10x throughput over 64bit Cityhash from Data.HashFunction*.

... in general if one is looking for the absolute fastest implementation of a given hash function, they will likely be able to find a more specialized library that could provide better performance.

fleed commented 6 years ago

Then you for explanation