[benchmark] add interactive DevTools profiling mode#1537
Conversation
Add a profile mode to `@mui/internal-benchmark` that replaces the automated
measurement loop with an interactive, headed browser session for hand-driving
the DevTools profiler. Enabled via `createBenchmarkVitestConfig({ profile: true })`
or `BENCHMARK_PROFILE=true`.
Each `benchmark()` case renders a control panel with a Render/Unmount toggle,
an optional Run interaction button, and Finish. Profile runs drop the
determinism V8/GPU flags, render into a full desktop viewport, auto-open
DevTools, and use a 1-year test timeout since they are driven by hand.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Deploy previewhttps://deploy-preview-1537--mui-internal.netlify.app/ Bundle sizeTotal Size Change: 0B(0.00%) - Total Gzip Change: 0B(0.00%) Show details for 64 more bundles@mui/internal-docs-infra/abstractCreateDemo parsed: 0B(0.00%) gzip: 0B(0.00%) PerformanceTotal duration: 20.66 ms +1.08 ms(+5.5%) | Renders: 4 (+0) | Paint: 89.57 ms +3.88 ms(+4.5%) No significant changes — details Check out the code infra dashboard for more information about this PR. |
I had Claude output a profiling mode to be able to inspect benchmark cases without having to recreate the test cases.
Summary
Adds an interactive profiling mode to
@mui/internal-benchmarkthat replaces the automated measurement loop with a headed browser session for hand-driving the Chrome DevTools profiler.createBenchmarkVitestConfig({ profile: true })orBENCHMARK_PROFILE=true.benchmark()case renders a pinned control panel with a Render/Unmount toggle button, an optional Run interaction button, and Finish. The component stays unmounted until you click Render, so you can start the profiler first.--no-opt,--predictable,--disable-gpu, …) so the numbers reflect realistic performance.profileViewport/BENCHMARK_PROFILE_VIEWPORT) and sizes the browser window to match.createElementTimingWaiter()helper used by both the measurement loop and the profiling session.Test plan
BENCHMARK_PROFILE=true vitest run -t "<case>"opens a headed Chromium window with DevTools and the control panel.🤖 Generated with Claude Code