Verification Checkpoints
Reference: Chrome for Testing 149.0.7827.55, arm64 macOS. Ratios are the pass condition; absolute nanoseconds are machine-specific.
Checkpoint 1 — The IC curve has a cliff, not a slope
npm run ic
Pass: 1 and 2 shapes are indistinguishable; 8 and 16 shapes are ~1.5–2.5× slower than 1; 8 and 16 are within noise of each other.
That last clause is the real check. If 16 is markedly worse than 8, you are measuring something other than IC state — most likely cache pressure from the larger objects.
Checkpoint 2 — delete dominates; property order does not
npm run shapes
Pass: delete is ≥ 5× variant A. Alternating property order is < 1.5×. o.tmp = undefined is
within noise of A.
Fail — delete under 2×: V8 kept the object in fast mode (small objects with few properties
sometimes avoid dictionary mode). Raise N, or add more properties before deleting.
Checkpoint 3 — Element-kind differences are ~1 ns/element
npm run arrays
Pass: spread across the four kinds is under ~3×, and every value is in the 0.5–3 ns/element range.
Expected oddity: PACKED_DOUBLE may measure faster than PACKED_SMI. This reproduced here
(0.60×) and is documented as unexplained in measured-results.md §3. If you see it, you have
reproduced the module's result, not made a mistake.
Fail — all four identical to two decimals: the summing operation is forcing generic element
access in every case (a typeof guard will do this), or per-rep work is below timer resolution.
Checkpoint 4 — The perspective table
npm run perspective
Pass: the ordering holds, spanning ~5 orders of magnitude:
property read < listener pair < create+append < forced layout < JSON.parse
~1 ns ~130 ns ~360 ns ~4,200 ns ~400,000 ns
The checkpoint is not the numbers — it is that you can state the consequence: one forced layout removed is worth ~1,400 de-megamorphised property reads; one avoided 200 KB JSON parse is worth ~136,000.
Fail — forced layout under 500 ns: the element has no layout-affecting context, so
getBoundingClientRect is nearly free. Ensure it is attached and in flow.
Checkpoint 5 — You can refuse the work
Not a script. Write a short review response to this proposal:
"I profiled our table component and found megamorphic property access in the row renderer. I'd like a sprint to normalise the row object shapes. I measured a 2× improvement on the property access microbenchmark."
Pass: your response prices the claim in absolute terms against the real operation count, identifies at least one alternative on the same critical path with a larger return, and says whether the answer would change if this were a 10M-cell virtualized grid. Agreeing is a valid answer if the arithmetic supports it — the checkpoint is the arithmetic, not the verdict.
Module completion
- Checkpoints 1–5
-
steps/05-principal-review.mdanswered in writing - One real code path in a codebase you own, priced with the perspective method — including a stated decision not to optimise it if that is what the numbers say
-
Learning log updated, including the unexplained
PACKED_DOUBLEresult as an open question