mirror of
https://github.com/lz4/lz4.git
synced 2026-10-24 01:48:57 +03:00
lz4hc : copy the tables of an attached dictionary from 4 KB inputs
LZ4_compress_HC_continue() copied the tables of an attached dictionary only above 4 KB, so 4 KB pages, the most common size, used the dictCtx search. They now use the copy. At 4096 bytes, with a 64 KB dictionary, compared to the dictCtx search : level 2 : -2.6% compressed size (it only searched the dictionary when the page had no match), levels 3-9 : same output, levels 10-11 : -0.3% / -0.1%, level 12 : same output. Speed, AMD EPYC Genoa (Zen 4), x86-64, gcc 11 / gcc 15 / clang 22 : level 2 : -1 to +2%, levels 3-9 : -3.3 to +4.7%, level 10 : -6 to -11%, level 11 : +12 to +23%, level 12 : +95 to +130%. x86 (gcc 12 -m32) : level 2 : -2.7%, levels 3-9 : -0.3 to -3.1%, level 10 : -2.5%, level 11 : +27%, level 12 : +172%.
This commit is contained in:
1
NEWS
1
NEWS
@@ -29,6 +29,7 @@ perf : `LZ4_FAST_DEC_LOOP` enabled on aarch64 with clang, including Android (up
|
||||
perf : `LZ4_FAST_DEC_LOOP` enabled on riscv64 when unaligned accesses are fast (`-mno-strict-align`, or a `-mcpu` with fast unaligned accesses)
|
||||
perf : faster compression with reused contexts, for blocks >= 1 KB : linked frames (up to +69%), `LZ4_resetStream_fast()` (up to +94%)
|
||||
perf : faster compression of 2-4 KB blocks with `LZ4_attach_dictionary()` (+3% to +30% on Zen 4)
|
||||
perf : 4 KB blocks with `LZ4_attach_HC_dictionary()` : level 2 compresses ~2.5% better, levels 11-12 faster (+12% to +170%), level 10 slower (-3% to -11%)
|
||||
perf : level 2 compresses better (~0.2-1.5%), at similar speed (-3% to +1% on Zen 4)
|
||||
perf : faster levels 11 (~+25%) and 12 (~+10%)
|
||||
perf : `--favor-decSpeed` : faster decompression (~+2-4% at level 12), with fewer sequences
|
||||
|
||||
@@ -1483,7 +1483,7 @@ LZ4HC_compress_generic_dictCtx (
|
||||
if (position >= 64 KB) {
|
||||
ctx->dictCtx = NULL;
|
||||
return LZ4HC_compress_generic_noDictCtx(ctx, src, dst, srcSizePtr, dstCapacity, cLevel, limit);
|
||||
} else if (position == 0 && *srcSizePtr > 4 KB && isStateCompatible(ctx, ctx->dictCtx)) {
|
||||
} else if (position == 0 && *srcSizePtr >= 4 KB && isStateCompatible(ctx, ctx->dictCtx)) {
|
||||
/* parameters belong to the working context, not to the dictionary */
|
||||
LZ4_i8 const favorDecSpeed = ctx->favorDecSpeed;
|
||||
LZ4_memcpy(ctx, ctx->dictCtx, sizeof(LZ4HC_CCtx_internal));
|
||||
|
||||
Reference in New Issue
Block a user