gxhash icon indicating copy to clipboard operation
gxhash copied to clipboard

Only hit the RNG once per thread

Open vlovich opened this issue 1 year ago • 1 comments

It looks like GxBuildHasher accesses the Rng on every construction. Can the technique from RandomState be used instead which only does the RNG once per thread & then simply adds 1 to the state used on each construction?

vlovich avatar May 13 '24 17:05 vlovich

Indeed, that would probably increase performance in scenarios where a BuildHasher is created for hashing only a few bytes. This RandomState w/ increment is interesting (and battle-tested since it's in the std), let's explore this.

First we might want to setup a benchmark to have a sense of the rng overhead relative to the hashing process and to get some before/after numbers.

ogxd avatar May 14 '24 11:05 ogxd