Skip to content

Bound common-line pruning to the local window - #46

Merged
pascalkuthe merged 2 commits into
maintain-0.1from
fix-timeout-window-0.1
Jun 21, 2026
Merged

Bound common-line pruning to the local window#46
pascalkuthe merged 2 commits into
maintain-0.1from
fix-timeout-window-0.1

Conversation

@Byron

@Byron Byron commented Mar 23, 2026

Copy link
Copy Markdown
Collaborator

This PR fixes a performance regression. I validated the work done by Codex, also by running the Gitoxide test-suite against it. It's not the largest in the world for diffing, but it's something.

Test Results

  • Unfixed 0.1.8: 24.19s
  • Fixed 0.1.x: 0.15s

Tasks

  • human review
  • fix clippy because it's a good time to do that now

Fix should_prune_common_line() so the backward scan starts at pos.saturating_sub(WINDOW_SIZE) instead of the absolute WINDOW_SIZE index.

The old bound made the scanned range grow with pos, which turned the preprocessing heuristic into an increasingly expensive rescan on highly repetitive inputs and caused the gix-merge clusterfuzz testcase to time out.

Add a regression test that proves distant context outside the local window does not affect the pruning decision.

@Byron
Byron marked this pull request as ready for review March 23, 2026 04:13
codex and others added 2 commits March 23, 2026 12:13
Fix should_prune_common_line() so the backward scan starts at
pos.saturating_sub(WINDOW_SIZE) instead of the absolute WINDOW_SIZE
index.

The old bound made the scanned range grow with pos, which turned the
preprocessing heuristic into an increasingly expensive rescan on highly
repetitive inputs and caused the gix-merge clusterfuzz testcase to time
out.

Add a regression test that proves distant context outside the local
window does not affect the pruning decision.

Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
@Byron
Byron force-pushed the fix-timeout-window-0.1 branch from d2c3597 to d2930d1 Compare March 23, 2026 04:15
@pascalkuthe
pascalkuthe merged commit 52dc63b into maintain-0.1 Jun 21, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants