Repository navigation
Commit ae70342
Usama Arif
compress: Elide long-offset path on 64-bit
ZSTD_seqToCodes() only enables longOffsets on 32-bit builds because the
64-bit bitstream accumulator can hold every supported offset. However,
ZSTD_encodeSequences_body() still tests the runtime flag for the first
sequence and every sequence in its hot loop.
Make the architecture condition explicit at both branches so 64-bit
compilers can discard the unreachable path. Add an assertion documenting
the invariant while preserving the existing 32-bit behavior.
In five alternating GCC 11.5 fullbench runs encoding sequences for an
8 MiB, 50%-compressible level-3 sample, throughput increased from
1201.6 to 1213.4 MB/s on average (+1.0%) with identical 2,706,887-byte
output. The fullbench text section also shrank by 512 bytes.
Signed-off-by: Usama Arif <usama.arif@linux.dev>1 parent d9c0c7e commit ae70342
1 file changed
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
| 303 | + | |
303 | 304 | | |
304 | 305 | | |
305 | 306 | | |
| |||
315 | 316 | | |
316 | 317 | | |
317 | 318 | | |
318 | | - | |
| 319 | + | |
319 | 320 | | |
320 | 321 | | |
321 | 322 | | |
| |||
353 | 354 | | |
354 | 355 | | |
355 | 356 | | |
356 | | - | |
| 357 | + | |
357 | 358 | | |
358 | 359 | | |
359 | 360 | | |
| |||
0 commit comments