Skip to content

Bound common-line pruning to the local window#46

Open
Byron wants to merge 2 commits into
maintain-0.1from
fix-timeout-window-0.1
Open

Bound common-line pruning to the local window#46
Byron wants to merge 2 commits into
maintain-0.1from
fix-timeout-window-0.1

Conversation

@Byron
Copy link
Copy Markdown
Collaborator

@Byron Byron commented Mar 23, 2026

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>
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.

2 participants