News for hackers. Stuff that matters.
Re:Ristretto: A High Performance, Concurrent, Memory-Bound G... by mrjn on Saturday September 21, 2019 @01:56PM (#21036824)
We will fix that in the near future. Known problem with our design choice. Wanted to ensure we put it out there first, before solving it. FWIW, note that the probability of a collision with 64 bit hash is pretty low. Still, needs to be solved.
Re:Ristretto: A High Performance, Concurrent, Memory-Bound G... by qes on Saturday September 21, 2019 @10:07PM (#21039190)
I use 128 bit spooky hash for keys in a system with ~1M keys in cache at any given time, give or take.

Rough numbers but maybe 75% of those keys existed last month and will still exist next month and probably next year, too, and 25% will exist for minutes to hours and likely never be seen again.

Collisions are uncommon, but a regular enough occurrence (dozen or two a year).

Re:Ristretto: A High Performance, Concurrent, Memory-Bound G... by grumpydba on Saturday September 21, 2019 @02:26PM (#21037014)
Could this be solved by some sort of cuckoo hashing?
Re:Ristretto: A High Performance, Concurrent, Memory-Bound G... by mrjn on Saturday September 21, 2019 @03:01PM (#21037210)
The benefit of current hashing algorithm is that Go team is maintaining it ;-). Its written in assembly and runs in single digit nanoseconds.

One way to check for collision would be to either store the key as well or use another hashing algorithm (which would further decrease the probability of collision, but not eliminate it). Either would introduce some slowness, because every Get would need to be checked.

Re:Ristretto: A High Performance, Concurrent, Memory-Bound G... by sethammons on Saturday September 21, 2019 @04:25PM (#21037720)
Storing the key with the value is a solid workaround.