Merge train 182: #10205 - #10206
Merged
Merged
Merge train 182: #10205#10206
Conversation
added 3 commits
September 13, 2026 14:07
…revious call's position (#10164) A JavaScript exec/test/search/matchAll step binds its subject afresh on every call, so on a non-ASCII (WTF-8) string each search paid a seek from the nearer end and a loop over one string did quadratic work. A per-thread four-entry table now remembers where the last such search stopped and hands that position to the next search on the same string. "The same string" is decided without a traced edge or per-object state: the concealed address, the byte and UTF-16 lengths, and a new per-thread heap generation must all match. The generation advances on entry and exit of a HeapChange scope around every event that frees or moves heap memory (copying minor, cycle Sweep and Reclaim steps, minor-prelude evacuation with a nested compaction scope, in-place promotion, gc_realloc, the synchronous sweep). Debug builds assert at every primitive that makes object memory reusable or evacuates a young object that a scope is open. RegExpHeader is unchanged (56 bytes); ASCII strings never consult the table. Tests: one per event kind asserting the generation advanced and the kind's own scope opened; a funnel assertion that can say no; linearity of a JS-level non-ASCII loop with and without positions; a moved string; and a different same-layout string at a freed string's address. Claude-Session: https://claude.ai/code/session_01Da12JXeG5XuVBma5yWp5C9
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (28)
📝 WalkthroughWalkthroughChangesRegex position reuse and heap identity
Estimated code review effort: 4 (Complex) | ~45 minutes Change: Bug fix · Severity of issue fixed: Medium Sequence Diagram(s)sequenceDiagram
participant JavaScript
participant RegexExecution
participant PositionHint
participant GarbageCollector
JavaScript->>RegexExecution: execute repeated non-ASCII search
RegexExecution->>PositionHint: look up string identity
PositionHint-->>RegexExecution: return prior position when valid
RegexExecution->>GarbageCollector: continue with possible collection
GarbageCollector->>PositionHint: invalidate identity through generation change
RegexExecution->>PositionHint: record post-search position
Suggested reviewers: ✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Merge train 182: lands #10205 (JS-level regex searches on non-ASCII strings resume from the previous call's position, via a per-thread heap generation; part of #10164 and #10165) at head
d04e162ba1, plus the workspace version bump to 0.5.1555.Both PR commits were cherry-picked onto
5d3bf85f9without conflicts.mainhas not moved since the PR's base, so the tree before the bump is byte-identical to the PR head, and the PR head's validation applies unchanged.Validation on that tree (perrymaster, Linux x86_64,
--locked):cargo fmt --all -- --checkcargo check -p perry-runtime --no-default-features --features full --lib(regex feature off): 0 warningscargo check -p perry-runtime --lib --tests: no warnings outside the knownglobal_this_webassembly.rsdead codecargo test -p perry-runtime --lib -- --test-threads=1: 3724 passed, 1 failed. The failure isnative_stack::tests::stack_top_respects_custom_thread_stack_sizes, red on main.cargo clippy -p perry-runtime --lib --tests: identical to train 181scripts/run_lint_gates.shscript tier: 76 of 77 pass. The failure is public benchmark evidence freshness, identical on main.check_changeset_fragment.sh PerryTS/perry 10205: passRe-checked on this branch after the bump:
cargo metadata --locked, fmt,gc_runtime_root_holders.py,check_file_size.sh.The PR has the tests, the 13 fault injections (all fail as required) and the measurements. The non-ASCII
execloop at 40,000 records drops from 28.5 s to 314 ms, andmatchAllfrom 26.9 s to 463 ms. ASCII per-call cost rises by 27–55 instructions (0.1–0.2 %).https://claude.ai/code/session_01Da12JXeG5XuVBma5yWp5C9
Summary by CodeRabbit
Performance
exec()andmatchAll()can now resume searches more efficiently across calls.Bug Fixes
Documentation