Repository navigation
perf(producer): worker sizing measures screenshot capture, one browser launch fewer - #6630
Conversation
Edit accuracy: accurate 271 (base branch 271), smooth 120 of thoseThe gate passes. Quarantined, measured but not gated (0) |
There was a problem hiding this comment.
Verdict: APPROVE · 0 blocker · 0 important · 0 nits · head 04384219
Scope
Calibration now uses the same capture mode that clamped parallel workers will use (DE off, same forceScreenshot). The predicate mirrors the call site's shouldClampDefaultDrawElement. deParallelStreamForced is only set when deParallelRouterEligible, and calibration is skipped then, so ignoring that flag here is safe. The calibration session is closed in finally, and probeSession passes through unchanged. The fails-without-fix test is named. All workflows are green on this head. The regression run hit a Docker layer-fetch error on shard-4, and the re-run passed.
What
Auto worker sizing now measures capture in screenshot mode, the mode the parallel workers it sizes actually use. Its calibration browser no longer starts in drawElement mode first.
Why
Calibration runs before every auto-sized multi-worker render. It launched its browser with drawElement on, but a multi-worker render then turns default-on drawElement off (
shouldClampDefaultDrawElement, "parallel capture has no runtime self-verification") and captures by screenshot. Two costs:Why under 100 lines
One lever: calibration samples frames in the capture mode the render will actually use. It is one helper at the existing call site plus its test; nothing else in sizing changes.
Related work
Refs #5945 (renders the fast capture refuses keep their parallel workers).
How
calibrationCaptureConfig(cfg)inrenderOrchestrator.tsasks the existing clamp predicate whether a parallel render would keep drawElement. If not, calibration getsuseDrawElement: false; an explicit opt-in (PRODUCER_EXPERIMENTAL_FAST_CAPTURE=trueorHF_DE_PARALLEL_STREAM=true) still calibrates in drawElement mode. The cloud planner's frame-cost probe (planFrameCost.ts) is untouched.Worker count only moves if the screenshot sample's p95 crosses the 600 ms calibration target where the drawElement sample did not, which can only lower the count. Frames are the same at any worker count.
Test plan
calibrationCaptureConfigmeasures screenshot by default and keeps drawElement for both opt-ins.renderOrchestrator.test.ts > calibrationCaptureConfig > measures screenshot capture, the mode parallel workers use(returning the config unchanged fails exactly this test, 1 failed / 290 passed).tsc --noEmit(producer) exit 0;renderOrchestrator.test.ts291 passed; oxfmt and oxlint clean on both files.Before / after
Published
hyperframes@0.8.210vs the same bundle with only this change (the one-line equivalent in the built chunk), Apple M4 Pro (14 cores, 24 GB, hardware GL),hyperframes renderon repo fixtures, one render at a time, interleaved, 5 runs each, medians.wall - compiledrops compile, which is network-bound for these fixtures (a remote video) and swings by several seconds.style-11-prod, 1080x1920, 14 soverlay-montage-prod+ one mix-blend layer, 1080x1920, 42 s