Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitba95829

Browse files
committed
Speed up generation of Unicode hash functions.
Sets of Unicode keys are picky about the primes used when generatinga perfect hash function for them. Callers can spend many secondsiterating through all the possible combinations of candidatemultipliers and seeds to find one that works.Unicode updates typically happen only once a year, but it still makesdevelopment and testing of Unicode scripts unnecessarily slow. To fix,iterate over the primes in the innermost loop. This does not changeany existing functions checked into the tree.
1 parentb05f7ec commitba95829

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎src/tools/PerfectHash.pm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ sub generate_hash_function
8787
my$hash_seed2;
8888
my@subresult;
8989
FIND_PARAMS:
90-
foreach (17, 31, 127, 8191)
90+
for ($hash_seed1 = 0;$hash_seed1 < 10;$hash_seed1++)
9191
{
92-
$hash_mult2 =$_;# "foreach $hash_mult2" doesn't work
93-
for ($hash_seed1 = 0;$hash_seed1 < 10;$hash_seed1++)
92+
for ($hash_seed2 = 0;$hash_seed2 < 10;$hash_seed2++)
9493
{
95-
for ($hash_seed2 = 0;$hash_seed2 < 10;$hash_seed2++)
94+
foreach (17, 31, 127, 8191)
9695
{
96+
$hash_mult2 =$_;# "foreach $hash_mult2" doesn't work
9797
@subresult = _construct_hash_table(
9898
$keys_ref,$hash_mult1,$hash_mult2,
9999
$hash_seed1,$hash_seed2);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp