allegro / bigcache

Efficient cache for gigabytes of data written in Go.
http://allegro.tech/2016/03/writing-fast-cache-service-in-go.html
Apache License 2.0
7.53k stars 597 forks source link

how about higher quality hash algorithm? #323

Open chen-zhuohan opened 2 years ago

chen-zhuohan commented 2 years ago

Although hash algorithm is not the Bottleneck of bigcache, the smhasher(the project of hash function quality and speed tests) show that FVNa has poor quality while other hash func has higher.

Should we evaluate the default hash func of bigcache again? After the question and answer of hash, lots of new hash functions come out, such as xxhash, wyhash, menhash, which have higher quality.

Due to some hash functions use hardware instructions provided by the CPU to accelerate (AVX2, SSE), we can use different hash func in different Platform, such as:

  1. FVNa default
  2. xxhash in amd

By the way, why bigcache has no dependence? Should only no dependence PR can be approve?

Look forward to your reply!

janisz commented 2 years ago

By the way, why bigcache has no dependence? Should only no dependence PR can be approve?

Making golang the only dependency makes this lib easy to use and update. I think we should keep it that way.

We have Hasher interface introduced in https://github.com/allegro/bigcache/pull/5 to enable users using their own hash method. I think it will be great if you can create hasher implementation with benchmarks on different datasets and machines. We can link to it from readme so if anybody need it they are free to add dependency.