aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorW. Felix Handte <w@felixhandte.com>2021-12-13 15:46:41 -0500
committerW. Felix Handte <w@felixhandte.com>2021-12-13 16:59:33 -0500
commit82a49c88f917c73b56780398fee65665a6e2a25e (patch)
tree2934b09e9ce6ee3315687328579c3a6141de8346
parent6ca5f424025d0f34cf1234cde0ba13b20469da46 (diff)
downloadzstd-82a49c88f917c73b56780398fee65665a6e2a25e.tar.gz
Increment Step by 1 not 2
I couldn't find a good way to spread `ip0` and `ip1` apart when we accelerate due to incompressible inputs. (The methods I tried slowed things down quite a bit.) Since we aren't splaying ip0 and ip1 apart (which would be like `0_1_2_3_`, as opposed to the `01__23__` we were actually doing), it's a big ambitious to increment `step` by 2. Instead, let's increment it by 1, which has the benefit sliiightly improving compression. Speed remains pretty much unchanged.
-rw-r--r--lib/compress/zstd_fast.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/compress/zstd_fast.c b/lib/compress/zstd_fast.c
index 852f4286..2bae2f70 100644
--- a/lib/compress/zstd_fast.c
+++ b/lib/compress/zstd_fast.c
@@ -234,19 +234,19 @@ _start: /* Requires: ip0 */
hash0 = hash1;
hash1 = ZSTD_hashPtr(ip2, hlog, mls);
+ /* advance to next positions */
+ ip0 = ip1;
+ ip1 = ip2;
+ ip2 = ip0 + step;
+ ip3 = ip1 + step;
+
/* calculate step */
if (ip2 >= nextStep) {
+ step++;
PREFETCH_L1(ip1 + 64);
PREFETCH_L1(ip1 + 128);
- step += 2;
nextStep += kStepIncr;
}
-
- /* advance to next positions */
- ip0 = ip1;
- ip1 = ip2;
- ip2 = ip0 + step;
- ip3 = ip1 + step;
} while (ip3 < ilimit);
_cleanup: