Merge train 184: #10212 - #10214
Merged
Merged
Merge train 184: #10212#10214
Conversation
added 3 commits
September 13, 2026 15:46
…tch inline, copy ASCII captures in one pass (#10166) Instruction attribution on the #10166 probes put a hoisted short-string `RegExp.prototype.test` at 23.7k instructions per call and `exec` with captures at 40.2k, with the engine itself about 12% and 7% of those. - `perex_dispatch::execute` performed `Get(R, "exec")` through the generic property path on every call, about half of each `test`. When the receiver is a RegExp and `regexp_view_uses_builtin` proves its own properties, prototype and `exec` are the untouched builtins, that Get reaches the builtin without running anything, so it is skipped. Any other receiver takes the Get. - `find_near` heap-allocated match registers per call and noted them to the collector inside a try frame, about a tenth of each `test`. `Slots` holds up to 32 registers and 16 capture spans inline; frames and undo start empty and still grow through `rebuffer` onto heap buffers. Inline slots are charged to the operation's memory limit exactly as a buffer of the same count is, so the limit and peak accounting are unchanged. - `copy_span_near` decoded each capture unit by unit through `BoundSpan` and re-encoded it, twice. On an ASCII subject UTF-16 offsets are byte offsets and the bytes are already the output encoding, so the span is copied as one byte range. Other subjects keep the existing path. No Perex change is needed. Tests: `perex_dispatch_skips_the_exec_lookup_only_when_nothing_can_observe_it` counts lookups — none for an untouched RegExp after its first call, and a lookup that runs the override for an own `exec`, a reparented RegExp and a replaced `RegExp.prototype.exec`. `perex_public_exec_captures_agree_across_ inline_and_heap_slots_and_storage` checks every group for inline and heap slot counts, a backtracking alternation that grows frames, unset and empty groups, behind an ASCII and a non-ASCII prefix, under forced evacuation. Three injected faults are caught: dropping the builtin-view check (four dispatch and search tests), truncating large programs into inline slots, and an off-by-one ASCII copy (three capture tests). `perex_` and `regex::` suites: 168 passed. Claude-Session: https://claude.ai/code/session_01RJkA4Fhqz9J5F5fzDk5HWv
|
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)
📝 WalkthroughWalkthroughThe regex runtime now skips unobservable builtin ChangesRegExp execution optimizations
Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Refactor Sequence Diagram(s)sequenceDiagram
participant RegExpReceiver
participant execute
participant execOverride
participant execute_with_resources
RegExpReceiver->>execute: execute(receiver, input)
alt known builtin receiver
execute->>execute_with_resources: run builtin matcher
else lookup required
execute->>RegExpReceiver: Get(receiver, "exec")
execute->>execOverride: handle override
execOverride-->>execute: override result or builtin fallback
execute->>execute_with_resources: run builtin matcher when no override applies
end
✨ 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 184: lands #10212 (skip the unobservable exec lookup, keep small match scratch inline, copy ASCII captures in one pass; #10166) at head
b96c44d2fa, plus the workspace version bump to 0.5.1558.Both PR commits were cherry-picked onto
64f5249acwithout conflicts.mainhas not moved since the PR's base, so the tree before the bump is byte-identical to the PR head.Review:
executeskipsGet(R, "exec")only whenis_valid_regex_ptr && regexp_view_uses_builtin, the same non-observable admission split's forward path uses. Inline match slots are charged to and released from the operation'sMemoryBudgetexactly as a heap buffer is. The ASCII capture copy reads the subject'sascii_bytes()under one view that neither allocates nor collects.Instruction counts are on #10212 (perf stat
instructions:u, per call, vsmain): hoisted test −49.4 %, literal test −46.5 %, exec with captures −30.4 %,/gtest −44.2 %, non-ASCII exec −2.9 %, non-ASCII exec loop −3.2 % per match. There are no regressions, and outputs match Node.Local validation of this branch (perrymaster, Linux x86_64,
--locked):cargo metadata --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: one warning outside the knownglobal_this_webassembly.rsdead code. It isobject/field_get_set/ic_miss/ic_slow.rs:544("value assigned tocacheis never read"), which comes frommain's own perf(codegen): collapse the generic property-get tower to two exits #10196 / generic property-get commits; this PR does not touch that file.cargo test -p perry-runtime --lib -- --test-threads=1: 3739 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: the same 12approx_constanterrors. Compared with train 181's warning diff, the only addition is that sameic_slow.rswarning frommain.scripts/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.shandcheck_changeset_fragment.sh PerryTS/perry 10212pass.https://claude.ai/code/session_01Da12JXeG5XuVBma5yWp5C9
Summary by CodeRabbit
Performance
RegExp.prototype.test()andexec()performance for standard, unmodified regular expressions.Release