Improve set of candidate multipliers for perfect hash function generation
The previous set of multipliers was not adapted for large sets of short keys, and this new set of multipliers allows to generate perfect hash functions for larger sets without having an impact for existing callers of those functions, as experimentation has showed. A future commit will make use of that to improve the performance of unicode normalization. All multipliers compile to shift-and-add instructions on most platforms. This has been tested as far back as gcc 4.1 and clang 3.8. Author: John Naylor Reviewed-by: Mark Dilger, Michael Paquier Discussion: https://postgr.es/m/CACPNZCt4fbJ0_bGrN5QPt34N4whv=mszM0LMVQdoa2rC9UMRXA@mail.gmail.com
This commit is contained in:
parent
9868167500
commit
2a73164581
@ -81,13 +81,13 @@ sub generate_hash_function
|
||||
# to calculate via shift-and-add, so don't change them without care.
|
||||
# (Commonly, random seeds are tried, but we want reproducible results
|
||||
# from this program so we don't do that.)
|
||||
my $hash_mult1 = 31;
|
||||
my $hash_mult1 = 257;
|
||||
my $hash_mult2;
|
||||
my $hash_seed1;
|
||||
my $hash_seed2;
|
||||
my @subresult;
|
||||
FIND_PARAMS:
|
||||
foreach (127, 257, 521, 1033, 2053)
|
||||
foreach (17, 31, 127, 8191)
|
||||
{
|
||||
$hash_mult2 = $_; # "foreach $hash_mult2" doesn't work
|
||||
for ($hash_seed1 = 0; $hash_seed1 < 10; $hash_seed1++)
|
||||
|
Loading…
x
Reference in New Issue
Block a user