Repository navigation
Conversation
windows-latest now ships Visual Studio 2026, which lacks the v143 (VS 2022) toolset the .vcxproj files target, failing with MSB8020. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A match found by LCP has dict_pos>kShortPos, so it costs at least cost[curi-1]+posBit(kShortPos+1)+minLenBit(mLen). The search walks curMinLcp downward, so once every mLen<=curMinLcp (<_k_kBMatchStep) can't reach cost[curi+mLen-1], this and all later matches write nothing and no longer change out_maxMatchLen; return early. Output is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BrianPugh
force-pushed
the
perf/lcp-early-exit
branch
from
September 30, 2026 00:21
c5c510c to
1a94239
Compare
Author
|
stacked on #21 to fix CI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey Sisong! I'm working on some compressor-speed optimizations; if you are okay with this relatively small PR, I'll open more to follow. These are all assuming that we care more about compressor-speed and compression-ratios over memory-usage/binary-size. Let me know if this assumption is incorrect.
This PR speeds up the compressor ~1.4–1.5x (CPU time) on binary deltas and firmware, up to 3.5x on repetitive text, with byte-identical output, by stopping the LCP match search once no remaining match can lower any cost.
dict_pos>kShortPos, so its cost is at leastminDictLenBitis the smaller of the near/far length bit counts, precomputed once).curMinLcpin decreasing order, so once nomLen<=curMinLcpcan reachcost[curi+mLen-1], this match and every later (shorter) one writes nothing and leavesout_maxMatchLenunchanged._k_kBMatchStep, so the big-match return is untouched.On repetitive input the LCP walk used to run to its 2048 limit at most positions, and ~97% of those iterations could never lower a cost.
Benchmarks
Median CPU seconds (user+sys) of 9 runs,
tinyuz -c-<dictSize> -p-1, clang-O3, Apple M3. Variants were interleaved in random order each round; in every cell the 9 runs span at most 4% of the median.On random data (where the LCP walk is already short) the per-position bound check costs ~2%.
Additional Memory Consumption: one
(_k_kBMatchStep)×4-byte table (2 KB) per matcher.Byte-identity
476/476 outputs identical to the baseline (1d74ffa), and each decodes back to its input with the unchanged decoder: 17 files (real binary deltas, raw firmware, random, zeros, repetitive text, 0–65537-byte edge files) × dict {256, 1k, 3000, 4k, 64k, 1m, 16m} × {
-c,-ci} × threads {1, 4}.