Skip to content

tooling: add profiling harness for V8 cpu/heap/tick profiles#69

Merged
7rulnik merged 1 commit into
mainfrom
tooling/profile-harness
May 10, 2026
Merged

tooling: add profiling harness for V8 cpu/heap/tick profiles#69
7rulnik merged 1 commit into
mainfrom
tooling/profile-harness

Conversation

@7rulnik
Copy link
Copy Markdown
Owner

@7rulnik 7rulnik commented May 10, 2026

Summary

Adds a small profiling harness so the next round of perf work can be driven by measured hot frames instead of guesses. Pairs naturally with the existing scripts/bench-diff.sh workflow — bench-diff tells you whether a change is a win, this harness tells you where to look for one.

  • scripts/profile-driver.js — runs ONE scenario (init / opf / gpf / eachmap-gen / eachmap-orig) against ONE fixture, sized so a single node invocation produces a useful profile. Warms up before the measured loop so V8 has tier-upped before sampling starts. Honors SCENARIO / FIXTURE / ITERS / WARMUP env vars.
  • scripts/profile.sh — wraps node with --cpu-prof, --heap-prof, and --prof flags and writes outputs to tmp/profiles/. Honors a MODE env var (all / cpu / heap / prof) so individual modes can be run alone.
  • scripts/analyze-cpuprofile.js — bucket-by-frame self-time summary of a .cpuprofile (top N).
  • scripts/analyze-heapprofile.js — bucket-by-frame self-allocation-bytes summary of a .heapprofile (top N).
  • .gitignore — adds tmp/ so profile output stays out of version control.

The CPU profile output (via Chrome DevTools or the analyzer) was what surfaced the gpf hot frame addressed in #68.

Usage

# default: opf scenario on babel.min.js.map, all three modes
scripts/profile.sh

# specific scenario / fixture
SCENARIO=gpf FIXTURE=vscode.map scripts/profile.sh

# cpu only
SCENARIO=init MODE=cpu scripts/profile.sh

# read top frames from the resulting profile
node scripts/analyze-cpuprofile.js tmp/profiles/gpf.cpuprofile 15

Test plan

  • Each scenario runs to completion under each mode against babel.min.js.map
  • Output files (.cpuprofile, .heapprofile, .prof.txt) are produced in tmp/profiles/
  • Both analyzers produce sane top-N tables
  • No production code is touched

@7rulnik 7rulnik merged commit ffab585 into main May 10, 2026
3 checks passed
@7rulnik 7rulnik deleted the tooling/profile-harness branch May 10, 2026 21:57
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