Skip to content

internal(bench-react): Add V8 opt/deopt investigation#3874

Merged
ntucker merged 3 commits intomasterfrom
bench-react-v8-deopt
Apr 5, 2026
Merged

internal(bench-react): Add V8 opt/deopt investigation#3874
ntucker merged 3 commits intomasterfrom
bench-react-v8-deopt

Conversation

@ntucker
Copy link
Copy Markdown
Collaborator

@ntucker ntucker commented Apr 5, 2026

Motivation

The Node benchmark (examples/benchmark) has start:trace and start:deopt scripts for V8 optimization/deoptimization investigation, but the React benchmark (examples/benchmark-react) had no equivalent. When investigating performance regressions that involve React rendering, you had to use the Node benchmark for deopt analysis and then separately validate with the React benchmark — with no way to see V8 JIT decisions in the browser context.

Solution

Add two new env-var-driven modes to the React benchmark runner:

  • BENCH_V8_TRACE=true — launches Chromium with --js-flags="--trace-opt --trace-deopt" via launchServer (needed because Browser from launch() has no process()), pipes browser stderr/stdout to v8-trace.log
  • BENCH_V8_DEOPT=true — launches Chromium with --js-flags="--prof", writes per-process V8 profiling logs to v8-logs/, and prints the node --prof-process command for the renderer log (largest file)

Convenience scripts bench:trace and bench:deopt default to --lib data-client --size small for focused investigation.

Files changed:

  • examples/benchmark-react/bench/runner.tslaunchBenchChromium(), buildV8LaunchArgs(), reportV8Logs()
  • examples/benchmark-react/package.jsonbench:trace, bench:deopt scripts
  • .gitignorev8-logs/
  • examples/benchmark-react/README.md — Profiling section
  • examples/benchmark-react/AGENTS.md — env var table
  • .cursor/rules/benchmarking.mdc — React benchmark profiling subsection

Open questions

N/A

Made with Cursor


Note

Low Risk
Low risk: changes are isolated to the React benchmark runner and docs, adding optional Chromium launch flags and log artifact handling with no impact on product/runtime code.

Overview
Adds opt-in V8 optimization/deoptimization investigation to examples/benchmark-react via BENCH_V8_TRACE and BENCH_V8_DEOPT, passing Chromium --js-flags for --trace-opt/--trace-deopt and --prof.

Updates the Playwright runner to optionally use chromium.launchServer() so root browser stdout/stderr can be piped to v8-trace.log, and to create/report v8-logs/ profiling artifacts after runs.

Introduces convenience scripts bench:trace/bench:deopt, documents the new modes, and ignores v8-logs/ in .gitignore.

Reviewed by Cursor Bugbot for commit faadd28. Bugbot is set up for automated code reviews on this repo. Configure here.

Add BENCH_V8_TRACE and BENCH_V8_DEOPT env vars to the React benchmark
runner. Trace mode uses launchServer to pipe Chromium's --trace-opt
--trace-deopt output to v8-trace.log. Deopt mode passes --prof to
write per-process V8 profiling logs to v8-logs/. Convenience scripts
bench:trace and bench:deopt default to data-client small scenarios.

Made-with: Cursor
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs-site Ignored Ignored Preview Apr 5, 2026 8:34pm

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 5, 2026

⚠️ No Changeset found

Latest commit: faadd28

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark React

Details
Benchmark suite Current: faadd28 Previous: 467a5f6 Ratio
data-client: getlist-100 165.3 ops/s (± 3.8%) 196.08 ops/s (± 2.7%) 1.19
data-client: getlist-500 44.84 ops/s (± 6.4%) 46.73 ops/s (± 5.8%) 1.04
data-client: update-entity 400 ops/s (± 4.8%) 425.72 ops/s (± 6.8%) 1.06
data-client: update-user 384.62 ops/s (± 6.6%) 434.78 ops/s (± 4.9%) 1.13
data-client: getlist-500-sorted 47.85 ops/s (± 6.3%) 49.14 ops/s (± 7.5%) 1.03
data-client: update-entity-sorted 333.33 ops/s (± 5.2%) 370.88 ops/s (± 5.8%) 1.11
data-client: update-entity-multi-view 370.37 ops/s (± 4.7%) 363.76 ops/s (± 10.1%) 0.98
data-client: list-detail-switch-10 11.85 ops/s (± 6.6%) 12.8 ops/s (± 6.5%) 1.08
data-client: update-user-10000 90.09 ops/s (± 2.2%) 91.74 ops/s (± 0.0%) 1.02
data-client: invalidate-and-resolve 49.5 ops/s (± 2.7%) 45.56 ops/s (± 6.4%) 0.92
data-client: unshift-item 285.71 ops/s (± 4.5%) 250 ops/s (± 5.6%) 0.88
data-client: delete-item 400 ops/s (± 4.3%) 384.62 ops/s (± 4.6%) 0.96
data-client: move-item 222.22 ops/s (± 4.2%) 243.9 ops/s (± 3.4%) 1.10

This comment was automatically generated by workflow using github-action-benchmark.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.10%. Comparing base (115c762) to head (faadd28).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3874   +/-   ##
=======================================
  Coverage   98.10%   98.10%           
=======================================
  Files         153      153           
  Lines        2899     2899           
  Branches      564      564           
=======================================
  Hits         2844     2844           
  Misses         11       11           
  Partials       44       44           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d7edab1. Configure here.

@ntucker ntucker merged commit f5797b4 into master Apr 5, 2026
23 checks passed
@ntucker ntucker deleted the bench-react-v8-deopt branch April 5, 2026 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant