Skip to content

Recycle temporary expression scopes on success and failure - #39

Draft
284km wants to merge 1 commit into
mainfrom
perf/reuse-scratch-scopes
Draft

284km wants to merge 1 commit into
mainfrom
perf/reuse-scratch-scopes

Conversation

@284km

@284km 284km commented Nov 7, 2026

Copy link
Copy Markdown
Owner

Temporary scopes for comparisons and attribute/index updates inherited the surrounding frame's capture marker. A closure holding the parent therefore prevented unrelated temporary copies from returning to the frame pool. Exceptions could also bypass cleanup entirely. Repeated expressions eventually exhausted the CI memory budget.

Clear inherited capture identity on detached copies, retain and register genuine captures, and use a shared cleanup path on both normal return and failure. Add a workload that checks values, closure lifetime and original exceptions, plus a macOS/Linux CI check that verifies frame allocations remain bounded as the iteration count grows.

Validation so far:

  • At 100 and 10,000 iterations, fresh frame counts fell from 602 / 60,002 to 3 / 3. The regression passes with hash indexing ON and OFF.
  • The unchanged TestHashOnly#test_broken_hash_value exceeded the 2 GiB limit on main e45622a; the fix passes both assertions in 31.9 seconds with 269,344 KiB peak process-family RSS.
  • Full corpus, full Hash file, Linux and final CI validation are in progress. This PR remains draft pending those checks.

This branch has not been deployed

No deployments
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