Merge train 179: #10181 - #10194
Merged
Merged
Merge train 179: #10181#10194
Conversation
added 4 commits
September 13, 2026 11:46
…tion (#10164) On non-ASCII (byte) storage a Perex search seeks to its start from the nearer end of the subject, up to half its length. A global replace or match starts a search per match, and split one per match or position, so the seeks summed to about n²/4: at 32,000 units that exceeded the former 100,000,000-unit allowance and threw, and without a cap it is quadratic time. Materializing captures seeked from an end the same way. Perex 0.1.2 adds a search-from-position API: Search::new_near and Search::position (the match end, or the start of the last attempt), and BoundSpan::new_near. perex_runtime::find_near and perex_strings::copy_span_near take an optional position; find and copy_span delegate to them with none. - perex_api::Reuse carries the last position of the reused subject, set only from and used only with that binding, because a position from another string with the same layout cannot be detected. execute_with_resources seeds each search and its capture materialization from it; global match copies each result from its search's end. - Split's forward search seeds each search from the previous one and materializes captures from the search's position. Tests: - perex_reuse: a non-ASCII global loop's work roughly doubles when the subject doubles (3.71x without positions); the #10164 reduction, a 32,000-unit split (6,001 pieces) and a 60,000-unit global replace (76,000 units), completes. - perex_split: a non-ASCII forward split's work roughly doubles when the input doubles (3.97x when it never resumes). Sabotage: each of those fails when positions are not used. Requires perex 0.1.2, published 2026-09-13 from PerryTS/perex d9f395d88931f0cfee1fe89ddf455cda606fd9e1 (crates.io checksum 21df239ee18f99de6abff50953f6f15be1b5ebd11e6ae9661acdd93026e983db). It is inside the workspace's 7-day min-publish-age window, so Cargo.lock was resolved once with CARGO_RESOLVER_INCOMPATIBLE_PUBLISH_AGE=allow, as for perex 0.1.0, with the maintainer's approval. Ordinary --locked builds use the locked version without the override. Claude-Session: https://claude.ai/code/session_01Da12JXeG5XuVBma5yWp5C9
gc_runtime_root_holders.py flags the new #[cfg(test)] LAST_FORWARD_WORK Cell<usize> under rule B. It is a test-only work count, never an 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 (12)
📝 WalkthroughWalkthroughRegex ChangesRegex position reuse
Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix · Severity of issue fixed: Medium Sequence Diagram(s)sequenceDiagram
participant Reuse
participant find_near
participant perex_split
participant copy_span_near
Reuse->>find_near: pass previous search Position
find_near-->>Reuse: return match and new Position
Reuse->>perex_split: continue split with new Position
perex_split->>copy_span_near: copy captures using Position
copy_span_near-->>perex_split: return copied span
✨ 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 was referenced Sep 13, 2026
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 179: lands #10181 (resume searches and capture reads from the previous position; part of #10164) at head
d5d1974324, plus the workspace version bump to 0.5.1551.The three PR commits were cherry-picked onto
df886c6445(train 178) without conflicts and match bygit patch-id --stable. The validated tree was built on train 178's pre-landing head40feb58c6, which has the same tree asdf886c6445. After re-parenting onto the landed commit, this branch's tree is byte-identical to the validated one (dc293b9d5c).Before landing, #10181 was restacked onto #10174 with one added commit,
gc: record the forward-split work counter's holder verdict.gc_runtime_root_holders.pyflagged the new#[cfg(test)] LAST_FORWARD_WORK: Cell<usize>under rule B, and the commit records it astest_only.Local validation (perrymaster, Linux x86_64;
--locked, no publish-age override in the environment). This tree includes perex 0.1.2 (lock checksum21df239ee18f99de6abff50953f6f15be1b5ebd11e6ae9661acdd93026e983db), resolved from the lock without the override.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: no warnings outside the knownglobal_this_webassembly.rsdead code on maincargo test -p perry-runtime --lib -- --test-threads=1: 3702 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 as main. Compared with train 178, this PR adds twotoo_many_argumentswarnings, onperex_runtime::find_near(9/7) andperex_results::materialize(8/7). Both functions gained thenearposition parameter. These are warnings only; clippy onmainreports about 1,100.scripts/run_lint_gates.shscript tier: 76 of 77 pass. The failure is public benchmark evidence freshness, identical on main at5cec2fbbc9. The compile tier was not run.check_changeset_fragment.sh PerryTS/perry 10181: passBehavioural evidence (linearity witnesses, fault injections, reproducer and harness measurements) is on #10181. GitHub runners are down, so this local replay is the gate. Next: #10183.
https://claude.ai/code/session_01Da12JXeG5XuVBma5yWp5C9
Summary by CodeRabbit
Performance
split,replace, and globalmatchoperations by continuing searches from the previous match.Documentation