@zakkster/lite-utils
Seven standalone CLIs for V8 diagnostics: six bash tools that compare two JS builds through V8's own traces --
bytecode length, deopts, inline caches, inlining decisions, young-GC counts, object shapes -- and one node tool that measures
steady-state on-heap bytes per op. Every verdict fails closed.

The V8 diff kit the ecosystem was missing
You changed a hot function. Did its bytecode grow? Did it start to deopt? Did an inline cache go megamorphic? Did
TurboFan stop inlining a callee? Did it start to trigger young-generation GCs? Did an object's shape or elements kind start to change? Each of these is a question V8 will
answer in its own trace output, but reading two traces by eye does not scale and a flaky comparison is worse than none.
lite-utils is seven self-contained command-line tools, one per question: six bash scripts and one node script
(alloc-per-op, described in its own section). Each bash tool runs your driver file on ONE node binary, under V8 trace
flags, reduces the trace to a normalized multiset, compares it between two builds, and ends with a VERDICT line and
an exit code. Anything it cannot establish is NO-VERDICT (exit 2), never a guess.
Install (version 1.2.0), three ways:
# 1. from the npm registry
npm i -D @zakkster/lite-utils
# 2. straight from the git repository (an instruction; it works once the repository is public)
npm i -D git+https://github.com/PeshoVurtoleta/lite-utils.git
# 3. copy one root script into your project and run it with bash (a root never sources anything at run time)
cp node_modules/@zakkster/lite-utils/bytecode-budget.sh tools/ && bash tools/bytecode-budget.sh -h
After an npm install the seven commands are allocation-diff, alloc-per-op, bytecode-budget, deopt-diff, ic-diff,
inlining-budget-diff and shape-diff, run as ./node_modules/.bin/<name> or npx <name>.
Quick-start: report the bytecode length of one function. Save this as driver.mjs:
function add(a, b) { return a + b; }
let s = 0;
for (let i = 0; i < 1000; i++) s = add(s, i);
./node_modules/.bin/bytecode-budget --fn add driver.mjs
Output (one run of the root script on node v26.8.2, bash 3.2.57, macOS arm64, 2026-11-12; the paths are that
host's, and the byte count is a node v26.8.2 value, not a constant):
bytecode-budget node v26.8.2 /opt/homebrew/bin/node (NODE_OPTIONS, NODE_V8_COVERAGE, NODE_COMPILE_CACHE, NODE_REDIRECT_WARNINGS stripped)
driver /tmp/b76p6-coder.ALDGJ6/qs/driver.mjs
mode report runs 2 v8 flags --no-flush-bytecode --print-bytecode --print-bytecode-filter=<fn>
limits TurboFan small<=30 (<=75 if a HeapNumber may cross) single<=460 | Maglev eager (greedy small)<30 small<=27 single<100
add: 1 match(es): 6
6 bytes: within every limit
add: REPORTED -- 1 match(es), not gated
VERDICT REPORTED
Report mode ends VERDICT REPORTED (exit 0) when it could read the length, VERDICT NO-VERDICT (exit 2) otherwise.
Table of contents
- Why this exists
- What you get
- bytecode-budget
- deopt-diff
- ic-diff
- inlining-budget-diff
- allocation-diff
- shape-diff
- alloc-per-op
- CLI reference
- Composability
- Design notes
- Design decisions worth knowing
- Testing
- Known limits
- What this is not
- Ecosystem
- License
Why this exists
A performance regression in a hot function rarely shows up as a failing test. It shows up as a function that got a few
bytes of bytecode longer and fell out of the inlining budget, a call site that went polymorphic, an optimization that
now bails out, or a loop that now allocates enough to trigger young-generation GCs. V8 reports every one of these, but
only through trace flags whose output is noisy (addresses, ids, timing) and changes between node versions.
These tools do the unglamorous part: they run the driver under the right flags on one pinned node binary, normalize the
trace, compare the two builds as an order-free multiset, and repeat the runs so that any run-to-run change in the answer is
caught by a null control and reported as NO-VERDICT instead of a false DIFF. They are plain bash plus POSIX
awk (alloc-per-op: plain node), with no runtime dependency, so a script can be copied into any repository.
What you get
| Tool |
Question |
Modes |
Verdict words |
Tier |
bytecode-budget |
How long is the bytecode of these functions? |
report, gate (--max), --diff (driver, ref, file) |
REPORTED / WITHIN / OVER; SAME / DIFF; NO-VERDICT |
DETERMINISTIC |
deopt-diff |
Which deopts did these functions have, before vs after? |
driver, ref, file, --self-test |
SAME / DIFF / NO-VERDICT |
STATISTICAL on a user driver |
ic-diff |
In which state did their inline-cache sites end? |
driver |
SAME / DIFF / NO-VERDICT |
STATISTICAL on a user driver |
inlining-budget-diff |
Which inlining decisions did TurboFan and Maglev make? |
driver (ref / file: lite-signal shaped) |
SAME / DIFF / NO-VERDICT |
STATISTICAL (budget report: REPORTED) |
allocation-diff |
How many young-generation GCs in a marked window? |
diff, --zero gate |
SAME / DIFF; ZERO / NONZERO; NO-VERDICT |
script logic DETERMINISTIC; user verdict STATISTICAL |
shape-diff |
Did the shapes, elements kinds or field representations of these functions' objects change, before vs after? |
driver, --self-test |
SAME / DIFF / NO-VERDICT |
--self-test DETERMINISTIC; a verdict on a user driver STATISTICAL, REPORTED only |
alloc-per-op |
How many on-heap bytes does one op of this lane allocate, steady state? |
table, gate (--max), A/B (--tol), --self-test |
PASS / FAIL; SAME / DIFF; NO VERDICT |
--self-test DETERMINISTIC; a verdict on a user lane STATISTICAL |
The tiers are the suite's verification tiers. DETERMINISTIC: the result does not depend on timing and is gated in
npm test. STATISTICAL: the result follows tier-up and GC timing, so a comparison on your driver is never gated here
and should be run on a quiet host. REPORTED: a table the tool prints, a measurement and not a law.
Every run of the six bash tools that reaches a verdict ends in a VERDICT <v> line on stdout. Exit codes: 0 = SAME /
WITHIN / REPORTED / ZERO, 1 = DIFF / OVER / NONZERO, 2 = NO-VERDICT or a refused argument. alloc-per-op has its own
verdict words and exit codes (its section below).
bytecode-budget
The bytecode LENGTH of named functions on one node binary: a report, a gate against per-function maxima, or a diff of
two drivers (or of one module at two git refs, or of a frozen copy and the live file).
bytecode-budget.sh [opts] --fn LIST DRIVER # report
bytecode-budget.sh [opts] --max fn=N[,fn=N] --node-version vX.Y.Z DRIVER # gate
bytecode-budget.sh [opts] --diff --fn LIST DRIVER_BEFORE DRIVER_AFTER # diff
bytecode-budget.sh [opts] --diff --fn LIST --out DIR --driver FILE --before-ref REF --after-ref REF --module REL
bytecode-budget.sh [opts] --diff --fn LIST --out DIR --driver FILE --before FILE --after FILE
- Gate. Every function named in
--max must have a length <= its maximum. The maxima record the node version they
were taken on (--node-version, required); a different node --version is NO-VERDICT before any probe, never a
failure. Exit 0 WITHIN, 1 OVER, 2 NO-VERDICT.
- Report. Exit 0
REPORTED, or 2 NO-VERDICT. The limit values it prints are this binary's, a measurement of that
binary.
- Diff. The length multisets of each function in the two builds are compared; exit 0
SAME, 1 DIFF, 2
NO-VERDICT. Ref mode reads --module at two git refs; file mode takes a frozen copy as --before and the live
file as --after.
- Matching is exact and counts every function with that name (same-name functions, class and object methods); each
one is gated.
read never matches reader.
- Tier: DETERMINISTIC. Bytecode length does not depend on tier-up timing; any run-to-run change is
NO-VERDICT.
The gate is pinned to one node version, so a stored maximum is only meaningful for the node version it names.
deopt-diff
The deoptimizations of named functions, before vs after, on one node binary: per function, the multiset of its deopt
records (code tier, kind, reason).
deopt-diff.sh [opts] --fn LIST DRIVER_BEFORE DRIVER_AFTER # driver mode: two drivers, one verdict
deopt-diff.sh [opts] --fn LIST --out DIR --driver FILE --before-ref REF --after-ref REF --module REL # ref mode
deopt-diff.sh [opts] --fn LIST --out DIR --driver FILE --before FILE --after FILE # file mode
deopt-diff.sh --self-test [--fixtures DIR]
- Verdict. Exit 0
SAME, 1 DIFF, 2 NO-VERDICT (NO-VERDICT > DIFF > SAME over every function).
- Tier. On a user driver the verdict is STATISTICAL (deopts follow tier-up timing; run it on a quiet host).
--self-test and --self-test --fixtures DIR (recorded traces) are DETERMINISTIC. The tier section it prints is
REPORTED and never moves the exit code.
- Controls. The repository carries a must-DIFF and a must-SAME driver pair that force tier-up with
--allow-natives-syntax, so the control runs deterministically in npm test (ROADMAP S-8).
ic-diff
The inline-cache states of named functions, before vs after, on one node binary: per function, the multiset of its IC
sites (kind, key, final state).
ic-diff.sh [opts] --fn LIST DRIVER_BEFORE DRIVER_AFTER # driver mode: two drivers, one verdict
ic-diff.sh --self-test
- Driver mode only. There is no ref or file mode.
- Verdict. Exit 0
SAME, 1 DIFF, 2 NO-VERDICT.
- Tier. On a user driver the verdict is STATISTICAL (IC states follow warm-up, GC and tier-up timing);
--self-test is DETERMINISTIC.
- Node 22 and 24. The tool always ends
NO-VERDICT there (a code-kind numbering table that is V8 14.x only), by
design, never a wrong verdict (LEDGER #83). V8 15.6 (node 27 alpha) shares the V8 14.x code-kind numbering (the
CODE_KIND_LIST of V8 src/objects/code-kind.h is identical at 14.6.202.34 and 15.6.75.25), so the tool gives
verdicts there; only the nightly exercises prerelease nodes, the CI matrix does not (LEDGER #128).
inlining-budget-diff
The TurboFan and Maglev inlining DECISIONS for named functions, before vs after, plus a budget report. Decision lines
are normalized, tagged with the compile unit they were made in, and compared per tier as a multiset.
ME=m0 inlining-budget-diff.sh [opts] DRIVER_BEFORE DRIVER_AFTER # driver mode (any project)
inlining-budget-diff.sh [opts] --before-ref REF --after-ref REF # lite-signal: builds from git refs
inlining-budget-diff.sh [opts] --before FILE --after FILE # lite-signal: two Signal.js files
- Driver mode works on any project; name the functions with
--fn LIST (default: $ME, else m0). The ref and
file modes are lite-signal shaped: the driver imports ./Signal.js and the tool stages Signal.js and Watch.js.
- Tiers.
--tiers LIST takes turbo,maglev (default both). On node 22 Maglev does not run by default, so the
maglev tier is NO-VERDICT; use --tiers turbo.
- Verdict (per tier). Exit 0
SAME, 1 DIFF, 2 NO-VERDICT. A run with no decision line naming the function and
no completed compile of it is NO-VERDICT, never "identical".
- Tier. The verdict is STATISTICAL (inlining follows tier-up timing); the budget report is REPORTED and is never
part of the verdict. A real comparison is never part of
npm test; only --self-test is gated, and there is no live
control for this tool.
- Artifacts.
--out DIR is always kept (default $OUTDIR, else $TMPDIR/inl-diff-<timestamp>); a rerun after a
refusal needs a fresh --out (LEDGER #76, #80).
allocation-diff
Young-generation GC EVENT COUNTS inside a marked window of a driver, one driver against another (diff) or one driver
against none (--zero), on one node binary. Counts, never bytes.
allocation-diff.sh [opts] DRIVER_BEFORE DRIVER_AFTER # diff mode: SAME / DIFF
allocation-diff.sh [opts] --zero DRIVER # gate mode: ZERO / NONZERO
allocation-diff.sh --self-test