Skip to content

[codex] Prioritize old reclaim at parse boundaries#5380

Merged
proggeramlug merged 1 commit into
codex/perry-gc-performance-cycle-20260618-40from
codex/perry-gc-performance-cycle-20260618-41
Jun 18, 2026
Merged

[codex] Prioritize old reclaim at parse boundaries#5380
proggeramlug merged 1 commit into
codex/perry-gc-performance-cycle-20260618-40from
codex/perry-gc-performance-cycle-20260618-41

Conversation

@andrewtdiz

Copy link
Copy Markdown
Contributor

Summary

  • Teach the pending tiny-parse GC boundary to honor old-generation reclaim pressure before scheduling another copied-minor collection.
  • Add a regression test that arms parse-boundary collection under old-gen pressure, verifies a full old_gen_bytes reclaim runs, and confirms a rooted old object survives.

Root Cause

bench_json_roundtrip was repeatedly entering parse-boundary copied-minor collections even after lazy JSON/tape churn had moved pressure into old/large-excluded storage. Those minor collections could not reclaim the dead old-gen pressure, so Perry spent time copying/promoting young objects while RSS kept growing.

Evidence

Targeted trace, same worktree before/after this commit, PERRY_GC_TRACE=1:

Metric Before After
stdout timing json_roundtrip:327 json_roundtrip:80
checksum 53735550 53735550
RSS 245588 KB 134528 KB
elapsed 0:00.39 0:00.14
GC events 36 minor 2 full
triggers 36 arena_bytes 2 old_gen_bytes
total GC pause 173554 us 31229 us
max GC pause 28927 us 16222 us
swept bytes 816368 94820920
copied bytes 10514712 0
promoted bytes 3502376 0

Full suite one-run after this change, with absolute JSON output path:

  • PERRY_BIN="$PWD/target/release/perry" benchmarks/compare.sh --full --runs 1 --json-out "$PWD/tmp/cycle41-profile/full-after.json" --warn-only
  • Target row improved from the pre-change cycle 41 suite run bench_json_roundtrip: 392ms / 236480KB to 91ms / 134660KB.
  • The compare script still reports broad regressions against historical baseline commit c89b3ad5; those are existing branch-vs-baseline differences from before this focused PR, not new rows introduced by this patch.

Validation

  • cargo fmt -- --check
  • cargo test -p perry-runtime gc::tests::triggers
  • cargo test -p perry-runtime gc::tests::host_safepoints
  • cargo test -p perry-runtime gc::tests::budgeted_step_api
  • cargo test -p perry-runtime json::
  • cargo build --release -p perry
  • Recompiled bench_json_roundtrip.ts with ./target/release/perry compile --no-cache ... and ran the traced benchmark above.

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 966cf3c2-d78a-4f1b-93a6-85a2aecd3a4a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/perry-gc-performance-cycle-20260618-41

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

@proggeramlug proggeramlug marked this pull request as ready for review June 18, 2026 05:40
@proggeramlug proggeramlug reopened this Jun 18, 2026
@proggeramlug proggeramlug force-pushed the codex/perry-gc-performance-cycle-20260618-41 branch from 984d47c to b9b4d16 Compare June 18, 2026 07:07
@proggeramlug proggeramlug force-pushed the codex/perry-gc-performance-cycle-20260618-40 branch from 554e382 to 2d83365 Compare June 18, 2026 07:08
@proggeramlug proggeramlug merged commit 7169ab7 into codex/perry-gc-performance-cycle-20260618-40 Jun 18, 2026
11 of 14 checks passed
@proggeramlug proggeramlug deleted the codex/perry-gc-performance-cycle-20260618-41 branch June 18, 2026 11:15
proggeramlug pushed a commit that referenced this pull request Jun 18, 2026
* Collect parse-boundary GC pressure

* Prioritize old reclaim at parse boundaries (#5380)
proggeramlug pushed a commit that referenced this pull request Jun 18, 2026
* Optimize length-only JSON.stringify locals

* [codex] Collect parse-boundary GC pressure (#5379)

* Collect parse-boundary GC pressure

* Prioritize old reclaim at parse boundaries (#5380)
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.

2 participants