diff options
author | Nathan Moinvaziri <nathan@nathanm.com> | 2020-04-21 10:29:37 -0700 |
---|---|---|
committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2020-04-30 10:01:46 +0200 |
commit | 0129e88cee5f5ac295c311d5d94f2bb6a2f475f6 (patch) | |
tree | f8ea2b566104af729458240ec415d8a5812b438e /insert_string.c | |
parent | 51e695092d18cae456af802bec106192f73d9bf6 (diff) |
Removed TRIGGER_LEVEL byte masking from INSERT_STRING and UPDATE_HASH due to poor performance on levels 6 and 9 especially with optimized versions of UPDATE_HASH.
From commit d306c75d3bb36cba73aec9b3b3ca378e31d1799e:
.. we hash 4 bytes, instead of 3, for certain levels. This shortens the hash chains, and also improves the quality
of each hash entry.
Diffstat (limited to 'insert_string.c')
-rw-r--r-- | insert_string.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/insert_string.c b/insert_string.c index 4e4c628..e9efd51 100644 --- a/insert_string.c +++ b/insert_string.c @@ -17,17 +17,10 @@ #if defined(__x86_64__) || defined(_M_X64) || defined(__i386) || defined(_M_IX86) # define UPDATE_HASH(s, h, val) \ - do {\ - if (s->level < TRIGGER_LEVEL)\ - h = (3483 * ((val) & 0xff) +\ - 23081* (((val) >> 8) & 0xff) +\ - 6954 * (((val) >> 16) & 0xff) +\ - 20947* (((val) >> 24) & 0xff));\ - else\ - h = (25881* (((val)) & 0xff) +\ - 24674* (((val) >> 8) & 0xff) +\ - 25811* (((val) >> 16) & 0xff));\ - } while (0) + h = (3483 * ((val) & 0xff) +\ + 23081 * (((val) >> 8) & 0xff) +\ + 6954 * (((val) >> 16) & 0xff) +\ + 20947 * (((val) >> 24) & 0xff)); #else # define UPDATE_HASH(s, h, val)\ h = (s->ins_h = ((s->ins_h << s->hash_shift) ^ ((val) >> ((MIN_MATCH - 1) * 8))) & s->hash_mask) |