In CanvasDrawEventRecorder::GetContiguousBuffer, reset mDropBufferOnZero to mDropBufferLimit (gfx.canvas.remote.drop-buffer-limit, default 100) after each spare-buffer drop instead of resetting it to 1.
Categories
(Core :: Performance: Automated Findings, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox160 | --- | fixed |
People
(Reporter: perf-ai-bot, Assigned: lsalzman)
References
(Blocks 1 open bug)
Details
(Whiteboard: [foofrix:b52c56a3-9cb7-4cf9-8e5a-e58d688d85f2])
Attachments
(1 external file)
In CanvasDrawEventRecorder::GetContiguousBuffer, reset mDropBufferOnZero to mDropBufferLimit (gfx.canvas.remote.drop-buffer-limit, default 100) after each spare-buffer drop instead of resetting it to 1.
Previously, after the initial threshold was reached, each following qualifying recycled-buffer switch could drop another buffer. The patch requires another full countdown after each drop, preserving reusable capacity across drawing bursts. A nonqualifying recycled-buffer switch resets the countdown; allocation paths leave it unchanged. This is a count of qualifying reuse observations, not a time interval or strictly consecutive allocation/reuse switches.
The existing back-pressure threshold, oversized-buffer handling, delayed dormancy cleanup (default 10000 ms), ClearCachedResources cleanup, and RECYCLE_BUFFER/DROP_BUFFER protocol remain unchanged. The normal default-sized pool can contain 256 queued buffers plus the current buffer: 257 × 32 KiB, approximately 8.03 MiB. This is not a cap on all recorder memory; oversized-event buffers and other allocations are separate.
Trade-off: spare shared-memory buffers remain allocated longer during active drawing. The content and translator processes map the same shared backing. Additional retained bytes and residency have not been measured.
Historical Linux results for speedometer4-scrollytelling-scrollama:
- Optimizer-reported pairs: 2.01/2.00/1.99 to 2.08/2.09/2.10 runs/min, approximately +4.50%.
- Stored pipeline comparison: 2.00/2.04/2.03 to 2.10/2.09/2.10 runs/min. Mean paired improvement is +3.63%; the ratio of mean scores, 2.023333 to 2.096667, is +3.62%.
These September 29 measurements predate the reviewed base. The relevant recorder and translator code is unchanged between the optimizer baseline and the review base.
The optimizer also reports a +4.27% focused microbenchmark result with identical pixel checksums, successful build/format checks, and 17 canvas WPTs with no unexpected results. The microbenchmark is informational and was not inspected or run in this review.
Problem
After the initial spare-buffer countdown expires, the original CanvasDrawEventRecorder::GetContiguousBuffer resets mDropBufferOnZero to 1. Each subsequent qualifying recycled-buffer switch can therefore drop another buffer until a nonqualifying reuse resets the countdown or the pool reaches its two-buffer minimum. Allocation paths preserve the countdown. Bursty drawing can consequently alternate rapid pool trimming with fresh allocation.
On the measured Linux path, acquiring a new buffer emits PAUSE_TRANSLATION, creates and maps shared memory using memfd_create/ftruncate/mmap, and sends AddBuffer IPC. Dropping buffers also incurs unmapping on the writer and translator sides.
Independently reproduced profile evidence, content main thread within 600 benchmark -sync/-async marker windows:
- GetContiguousBuffer inclusive samples: 1197 of 50564 active samples (2.367%) to 332 of 49017 (0.677%).
- Within that function, self samples: mmap 216 to 61, munmap 244 to 39, sendmsg 214 to 46. Samples under memfd_create fell from 140 to 35.
- Total active samples in the windows fell by 1547, or 3.06%. This is a single-profile comparison, not the end-to-end benchmark improvement.
- IncrementEventCount-related stacks increased from 534 to 626 samples; whole-thread DropFreeBuffers increased from 12 to 19.
Across the complete CanvasRenderer recordings, NextBuffer inclusive samples fell from 473 to 89 and munmap self samples from 807 to 393, while total active samples remained approximately 118000. These are translator-thread CPU measurements, not GPU execution-time measurements.
Performance
- Benchmark: speedometer4-scrollytelling-scrollama
- Test: sp4-scrollytelling-scrollama
- Component: Graphics
- Local Improvement: 3.62%
Validation
| Reporter | ||
Updated•1 month ago
|
| Reporter | ||
Comment 1•1 month ago
|
||
Please move this bug to the correct component.
Once the Phabricator patch is ready for review, please commandeer it.
| Reporter | ||
Comment 2•1 month ago
|
||
In CanvasDrawEventRecorder::GetContiguousBuffer, reset mDropBufferOnZero to mDropBufferLimit (gfx.canvas.remote.drop-buffer-limit, default 100) after each spare-buffer drop instead of resetting it to 1.
Updated•1 month ago
|
Updated•1 month ago
|
| Assignee | ||
Updated•1 month ago
|
Comment 4•1 month ago
|
||
| bugherder | ||
Updated•18 days ago
|
Description
•