Commit 0ab569d7 authored by Geoff Simmons's avatar Geoff Simmons

Add a comment about possible PH parameters for time/space tradeoffs.

Benchmarks of this idea can lead to improvements, by about 10 ns
per match operation, which makes a difference in throughput. But
we keep things simple for now.
parent dc585e1b
......@@ -123,6 +123,16 @@ lg(unsigned n)
return (lg);
}
/*
* Note: there's potential here to use parameters so that users can decide
* about a time/space tradeoff. It would allow bits to be increased up to
* a limit, increasing the size of the hash table and making it sparser
* (that's space). Do so until the expected collision rate falls below a
* threshold (time), or until an upper bound on the table size is reached.
*
* An estimate for the expected number of collisions is:
* (n * (n - 1)) >> (bits + 1)
*/
static uint32_t
getsz(unsigned n)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment