perf: make Rewrite transaction fragment handling O(n) instead of O(groups × fragments) - #24
Merged
Conversation
…oups * fragments) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
ACTION NEEDED The PR title and description are used as the merge commit message. Please update your PR title and description to match the specification. For details on the error please inspect the "PR Title Check" action. |
devin-ai-integration
Bot
force-pushed
the
devin/1787704701-txn-perf-exa6
branch
from
August 26, 2026 00:40
5a65483 to
c6c6492
Compare
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.
Summary
handle_rewrite_fragmentsrebuilt each rewrite group by scanning the whole fragment vector, so a compaction commit costO(groups × fragments). On a manifest with ~4.5M fragments and 128 groups per batch that dominates commit wall time. It now indexes once and rebuilds once:Contiguous groups keep their replacements at the original position; non-contiguous groups append, preserving the previous ordering semantics.
Second commit adds the safety guard the position-indexed form needs: two groups replacing the same fragment id used to silently overwrite one replacement entry (the old scan-and-splice form couldn't express that state). It's now a
CommitConflict, with a regression test.Targets the
exa/v9.0.1-txn-perfrelease line — the same change landed onmainas #22 and was reverted by #23, since production wheels are cut from this branch. The9.0.1+exa.6version bump follows in its own PR, as with #20 → #21.Link to Devin session: https://app.devin.ai/sessions/7d75a309bb144583a14b8704bbdb28e3
Requested by: @tanish-exa