Merge train 185: #10225 - #10227
Merged
Merged
Merge train 185: #10225#10227
Conversation
added 3 commits
September 13, 2026 20:55
…he builtin (#10165) RegExp @@replace materialized a full exec result array per match, then read length, 0, index, each capture and groups back through generic property gets, and pushed every capture into a traced list before building the output. For a receiver whose exec is the builtin (regexp_view_uses_builtin) and whose program has no named groups, those objects and reads cannot be observed, so this path collects each match's capture spans natively instead and builds the output from spans of the input. The specification's order is kept: every match is collected before the first replacer call, so a replacer that changes lastIndex, exec or the pattern cannot change which matches are replaced. flags and the lastIndex reset still run first, and admission is decided after them because either can run user code; inside the collection loop no user code can run. Templates are parsed once (GetSubstitution without named groups) and emit input spans, so $&, $n, $` and $' allocate nothing per match. Replacer calls get the same arguments. The spans follow the subject (matches x captures), so they live in a plain Vec reported to the collector as external bytes and are not charged to the operation's MemoryBudget (#10164/#10207). execute_with_resources gains an ExecOutput::Spans mode; its signature is unchanged. Tests: the direct path against the ordinary loop (output and final lastIndex) over templates with every $ form, zero-width global matches with and without u, sticky and non-global receivers, non-ASCII input; replacer arguments; a replacer that rewinds lastIndex and installs an own exec; admission declining for an own exec and for named groups; span storage one match past a SCRATCH_BYTES/8-entry cap. A debug assertion bounds the collection loop. 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 (10)
📝 WalkthroughWalkthroughChangesDirect RegExp replacement
Estimated code review effort: 4 (Complex) | ~45 minutes Change: Refactor Sequence Diagram(s)sequenceDiagram
participant RegExpReplace
participant DirectReplace
participant RegexExecution
participant Replacer
RegExpReplace->>DirectReplace: Check receiver eligibility
RegExpReplace->>DirectReplace: Start direct replacement
DirectReplace->>RegexExecution: Collect match and capture spans
RegexExecution-->>DirectReplace: Return spans
DirectReplace->>Replacer: Apply template or callback
DirectReplace-->>RegExpReplace: Return output string
✨ 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 185: lands #10225 (RegExp
replacewithout exec result objects when every step is the builtin; part of #10165) at head7a7f1d4621, plus the workspace version bump to 0.5.1561.Both PR commits were cherry-picked onto
bb9aa5a64without 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 outsideglobal_this_webassembly.rsandmain's ownic_slow.rs:544cargo test -p perry-runtime --lib -- --test-threads=1: 3754 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 tomainatbb9aa5a64scripts/run_lint_gates.shscript tier: 76 of 77 pass. The failure is public benchmark evidence freshness, identical on main.gc_runtime_root_holders.py,check_file_size.sh,check_changeset_fragment.sh PerryTS/perry 10225: passRe-checked on this branch after the bump:
cargo metadata --locked, fmt, holders, file size.Measured on #10225 (perf stat, 400,000 matches, vs
main):"[$&]"template: 3.0× lower, −52.6 %"$2$1"template: 4.5× lower, −69.5 %A 1M-record
replacestill fails on bothmainand this branch because of #10215; this change does not alter that.https://claude.ai/code/session_01Da12JXeG5XuVBma5yWp5C9
Summary by CodeRabbit
Performance
lastIndexhandling.Compatibility
Documentation