Add Live Debugger runtime benchmark coverage - #429
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Live Debugger Runtime BenchmarkSDK-loaded dormant-probe runtime overhead, measured against an uninstrumented bundle in the same browser session.
Full diagnosticsRaw samples are in the |
|
✅ All CI checks and tests passed. 🎉 All green!🧪 All tests passed 🔗 Commit SHA: f3cc0fe | Docs | View more details | Give us feedback! |
3a9f3d6 to
1296572
Compare
d80cc4f to
ba9d257
Compare
ba9d257 to
0168305
Compare
The browser Live Debugger instrumentation needs repeatable runtime overhead checks before transform changes land. Add an opt-in Playwright benchmark that compares baseline, control, and instrumented workloads in the same browser session with dormant probe hooks installed. Report conservative per-call overhead bounds with confidence intervals, A/A diagnostics, block bootstrap checks, and PR comment output. Wire the benchmark into CI as a non-blocking job, share Playwright setup between jobs, upload raw samples as artifacts, and document how contributors should run and interpret the benchmark.
0168305 to
0de9917
Compare
Grow near-target batches proportionally and lock the behavior down with a deterministic test. Co-authored-by: Cursor <cursoragent@cursor.com>
tylfin
left a comment
There was a problem hiding this comment.
LGTM, but I'll defer the CI changes and test configuration to the build-plugins team
| packages/tests/test-results | ||
| retention-days: 3 | ||
|
|
||
| runtime-bench-preflight: |
There was a problem hiding this comment.
Shouldn't this also be continue-on-error: true since the other one is?
| id: output-check | ||
| run: node packages/tests/src/bench/liveDebuggerRuntime/preflight.js --compare-output --base-ref=origin/${{ github.base_ref }} | ||
|
|
||
| runtime-bench: |
There was a problem hiding this comment.
Since we're posting comments in the PRs, maybe we'll need to avoid runs conflicting (quick succession of pushes).
This way, we only keep the latest one running.
| runtime-bench: | |
| runtime-bench: | |
| concurrency: { group: runtime-bench-${{ github.event.pull_request.number }}, cancel-in-progress: true } |
There was a problem hiding this comment.
nit: Should we also configure Test Optimization for this one too?
| if: ${{ github.event_name == 'pull_request' && !startsWith(github.ref_name, 'mq-working-branch-') }} | ||
| outputs: | ||
| should-run: ${{ steps.output-check.outputs.should-run || steps.changed-files.outputs.should-run }} | ||
| reason: ${{ steps.output-check.outputs.reason || steps.changed-files.outputs.reason }} |
| key: node18-cache-build-${{ hashFiles('packages/core/**', 'packages/factory/**', | ||
| 'packages/plugins/**', 'packages/published/**', | ||
| 'packages/tools/src/**', 'yarn.lock') }} |
There was a problem hiding this comment.
Not directly related to this PR, but it does increase an existing race risk.
Three jobs share the same cache key, lint, e2e and now runtime-bench as well.
Although, lint does a build slightly different with ADD_BUILD_PLUGINS and BUILD_PLUGINS_REPORTS.
Which means, if e2e or runtime-bench build first, lint won't have a report to upload.
Could you change the key for lint please?
| forbidOnly: !!process.env.CI, | ||
| retries: 0, | ||
| reporter: [['list'], ['./src/bench/liveDebuggerRuntime/reporter/benchReporter.ts']], | ||
| globalSetup: require.resolve('./src/_playwright/globalSetup.ts'), |
There was a problem hiding this comment.
Note that this will conflict with e2e runs, because it cleans the public dirs.
So if this runs at the same time as e2e, it might clear its fixtures mid-run.
Could be unlikely, but I felt like it was worth a mention.
build-plugins/packages/tests/src/_playwright/globalSetup.ts
Lines 37 to 42 in 38eda25
| const BENCH_BUNDLER = 'rspack'; | ||
| const BENCH_DEV_SERVER_PORT = 8001; | ||
| const BENCH_DEV_SERVER_URL = `http://localhost:${BENCH_DEV_SERVER_PORT}`; | ||
| const BENCH_BROWSERS = ['chrome', 'firefox', 'safari'] as const; |
There was a problem hiding this comment.
These could go in ./constants.ts.

What and why?
This adds repeatable browser runtime benchmark coverage for dormant Live Debugger instrumentation. The goal is to give Live Debugger browser changes a controlled way to track whether instrumentation changes introduce measurable overhead in real browsers.
How?
Adds a Playwright benchmark under
packages/tests/src/bench/liveDebuggerRuntimewith Tiny and Hot workload shapes, baseline/control/instrumented variants, and SDK-like dormant probe hooks installed in the page.Adds a custom reporter that computes conservative per-call overhead bounds, 95% confidence intervals, A/A diagnostics, moving-block bootstrap intervals, autocorrelation diagnostics, browser failures, raw JSON output, and a PR comment body.
Adds
yarn workspace @dd/tests bench:live-debugger:runtime, a dedicated Playwright config, result artifacts, a non-blocking CI job, a shared Playwright setup action, and Live Debugger contributor docs explaining how to run and interpret the benchmark.For more details, see the "Runtime benchmark" section in the added
CONTRIBUTING.mdfile in this PR.Validation
The benchmark runs in CI as a non-blocking job and uploads raw samples plus the generated report artifacts for review.
Benchmark note
The current benchmark numbers show a significant dormant-instrumentation overhead in Safari. Most of this is fixed in stacked PR #438.