perf(run): gate Playwright tracing behind PARITY_TRACE=1 - #176
Merged
Conversation
newContext() started tracing with { screenshots: true, snapshots: true } for
every side×viewport context whenever tracesDir was set, and run.ts always set
it. That buffer accumulates in the Chromium process for the whole flow
sequence (up to 420s) across up to 4 concurrent contexts — a real memory cost.
Nothing in the report or checks reads the trace; it's a human debugging
artifact only.
Only enable tracing (and write the trace zip) when PARITY_TRACE=1. Default
runs no longer pay the memory/disk cost.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
newContext()(src/engine/browser.ts) starts Playwright tracing with{ screenshots: true, snapshots: true }whenevertracesDiris passed, andrun.tsalways passed it. That trace buffer accumulates inside the Chromium process for the entire flow sequence (purchase-journey deadline is 420s) across up to 4 concurrentBrowserContexts — a real, sustained memory cost during every run.Nothing in the report or the checks reads the trace content — the
.zipis a human debugging artifact (Playwright trace viewer) only. So the default run pays the memory/disk cost for something almost never consumed.Fix
Gate tracing behind
PARITY_TRACE=1:run.tsonly passestracesDir(and only writes/stops the trace zip) when the env var is set.To capture a trace for debugging:
PARITY_TRACE=1 parity run ....Verification
bun run check(tsc) passes.PARITY_TRACEunset,<runDir>/traces/stays empty; withPARITY_TRACE=1, the<viewport>-<side>.ziptraces are written as before.Note
The plan also considered freeing
PageCapture.htmlafter checks (#5), but the report's section extraction and many checks readcapture.htmlthrough report generation, so trimming it isn't safe without moving HTML to disk — deferred. This PR ships the safe, isolated tracing win.Part of the memory-pressure / OOM series (see #173, #174, #175).
🤖 Generated with Claude Code
Summary by cubic
Gate Playwright tracing behind
PARITY_TRACE=1so default runs skip tracing, avoiding per-context snapshot buffers and trace zips. This reduces sustained memory use during flows.PARITY_TRACE=1 parity run ...Written for commit 919f5bc. Summary will update on new commits.