Skip to content

Merge train 179: #10181 - #10194

Merged
proggeramlug merged 4 commits into
mainfrom
train179
Sep 13, 2026
Merged

proggeramlug merged 4 commits into
mainfrom
train179

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

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 by git patch-id --stable. The validated tree was built on train 178's pre-landing head 40feb58c6, which has the same tree as df886c6445. 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.py flagged the new #[cfg(test)] LAST_FORWARD_WORK: Cell<usize> under rule B, and the commit records it as test_only.

Local validation (perrymaster, Linux x86_64; --locked, no publish-age override in the environment). This tree includes perex 0.1.2 (lock checksum 21df239ee18f99de6abff50953f6f15be1b5ebd11e6ae9661acdd93026e983db), resolved from the lock without the override.

  • cargo metadata --locked, cargo fmt --all -- --check
  • cargo check -p perry-runtime --no-default-features --features full --lib (regex feature off): 0 warnings
  • cargo check -p perry-runtime --lib --tests: no warnings outside the known global_this_webassembly.rs dead code on main
  • cargo test -p perry-runtime --lib -- --test-threads=1: 3702 passed, 1 failed. The failure is native_stack::tests::stack_top_respects_custom_thread_stack_sizes, red on main.
  • cargo clippy -p perry-runtime --lib --tests: the same 12 approx_constant errors as main. Compared with train 178, this PR adds two too_many_arguments warnings, on perex_runtime::find_near (9/7) and perex_results::materialize (8/7). Both functions gained the near position parameter. These are warnings only; clippy on main reports about 1,100.
  • scripts/run_lint_gates.sh script tier: 76 of 77 pass. The failure is public benchmark evidence freshness, identical on main at 5cec2fbbc9. The compile tier was not run.
  • check_changeset_fragment.sh PerryTS/perry 10181: pass

Behavioural 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

    • Improved performance for non-ASCII regular expression split, replace, and global match operations by continuing searches from the previous match.
    • Large-string operations now scale more efficiently, reducing unnecessary rescanning and helping avoid work-limit failures.
    • Capture extraction remains consistent while benefiting from the improved search behavior.
  • Documentation

    • Updated release documentation to describe the regular expression performance improvements.

Ralph Küpper 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
@proggeramlug
proggeramlug merged commit 820cf76 into main Sep 13, 2026
17 of 19 checks passed
@proggeramlug
proggeramlug deleted the train179 branch September 13, 2026 11:46
@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 756bcb1a-7230-4b69-bb9e-a5a2590a562f

📥 Commits

Reviewing files that changed from the base of the PR and between df886c6 and 5577019.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (12)
  • CLAUDE.md
  • Cargo.toml
  • changelog.d/10181-regex-resume-from-position.md
  • crates/perry-runtime/src/gc/tests/runtime_roots/perex_reuse.rs
  • crates/perry-runtime/src/gc/tests/runtime_roots/perex_split.rs
  • crates/perry-runtime/src/regex/perex_api.rs
  • crates/perry-runtime/src/regex/perex_match_search.rs
  • crates/perry-runtime/src/regex/perex_results.rs
  • crates/perry-runtime/src/regex/perex_runtime.rs
  • crates/perry-runtime/src/regex/perex_split.rs
  • crates/perry-runtime/src/regex/perex_strings.rs
  • scripts/gc_runtime_root_holders.json

📝 Walkthrough

Walkthrough

Regex split, replace, and global match operations now resume searches from prior positions on reusable subjects. Capture extraction and span copying use the same position. Tests measure linear scaling on non-ASCII input.

Changes

Regex position reuse

Layer / File(s) Summary
Search position API
crates/perry-runtime/src/regex/perex_api.rs, crates/perry-runtime/src/regex/perex_runtime.rs
Reuse stores the previous Position. find_near selects position-aware searches and returns the updated position.
Position-aware output paths
crates/perry-runtime/src/regex/perex_split.rs, crates/perry-runtime/src/regex/perex_results.rs, crates/perry-runtime/src/regex/perex_strings.rs, crates/perry-runtime/src/regex/perex_match_search.rs
Forward split searches and span copying use the tracked position. Forward-search work is recorded for tests.
Performance validation and release metadata
crates/perry-runtime/src/gc/tests/runtime_roots/perex_reuse.rs, crates/perry-runtime/src/gc/tests/runtime_roots/perex_split.rs, scripts/gc_runtime_root_holders.json, Cargo.toml, CLAUDE.md, changelog.d/10181-regex-resume-from-position.md
Tests cover linear scaling, large split and replace operations, and forward split work. The workspace version, perex requirement, documentation, and changelog are updated.

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
Loading
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch train179

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant