aboutsummaryrefslogtreecommitdiff
path: root/src/compat
diff options
context:
space:
mode:
authorMartin Ankerl <martin.ankerl@gmail.com>2018-05-06 13:55:33 +0200
committerMartin Ankerl <martin.ankerl@gmail.com>2018-05-06 13:55:33 +0200
commit9aac9f90d5e56752cc6cbfac48063ad29a01143c (patch)
treed31c9257dcb47c522d20b2859c87e164dd7eb8ca /src/compat
parent66cc47be982aa431b72494f5d655c20eea17a0f5 (diff)
replace modulus with FastMod
Replaces the slow modulo operation with a much faster 32bit multiplication & shift. This works because the hash should be uniformly distributed between 0 and 2^32-1. This speeds up the benchmark by a factor of about 1.3: RollingBloom, 5, 1500000, 3.73733, 4.97569e-07, 4.99002e-07, 4.98372e-07 # before RollingBloom, 5, 1500000, 2.86842, 3.81630e-07, 3.83730e-07, 3.82473e-07 # FastMod Be aware that this changes the position of the bits that are toggled, so this should probably not be used for CBloomFilter which is serialized.
Diffstat (limited to 'src/compat')
0 files changed, 0 insertions, 0 deletions