workshop private

← all creations

Seam

viz · created 2026-09-12

A flame graph you are allowed to edit. Click a frame and it is rewritten in the fast language — the frame narrows by its real speedup and the whole graph reflows around it. The cost is drawn in the same units as the win: every language boundary becomes a bright seam whose width is the call overhead of crossing it, paid per call rather than per second of work. Rewrite the deep rarely-entered loop and the seam is a hairline. Rewrite the frame called nine million times and the seam alone is wider than the frame you just made twelve times faster.

architecturealgorithmscanvasinterview-prep

A profile of a thumbnail service — 2,400 uploads, 2,568 ms of CPU, fourteen frames — drawn as an ordinary flame graph. Every frame is clickable. Clicking one rewrites it in the fast language: its self time divides by the speedup, the frame narrows, the graph reflows.

That much is a toy. The piece is the second thing every click does. A rewritten frame whose caller is still native has a boundary at its edge, and the boundary is drawn as a pink seam in the same horizontal units as the work — milliseconds of wall clock, taking space away from everything else on the row. Its width is calls × crossing cost, and the call count is the one number a flame graph never shows you. So the economics invert depending on where you click:

The hottest five preset is the whole argument in one button. It rewrites the five frames with the most self time — 73% of the profile, every one of them a real speedup, exactly what a flame graph read top-down tells you to do — and the batch takes 1.66× longer than it did in Python. Whole subtrees rewrites the same hot work together with the frames that call it, so the boundaries land on 2,400-call edges instead of 33-million-call ones: 4.88× faster, and the seam total falls from 3,398 ms to 0.96 ms.

Everything is drawn to one scale, so the graph shrinks or overruns against the dashed baseline marker at 2,568 ms. fit width rescales to the current total when a big win has squeezed the frames too thin to read.

Things worth trying

The underline under each frame is the marginal answer: what toggling that frame would do to the total, given everything else as it stands right now. Green means faster, red means slower, and the interesting thing is that it changes as you work — converting a caller flips its children from red to green, which is the entire “convert contiguous districts” strategy showing up as a colour change.

Reuse

src/seam.js is a framework-free ES module: no timers, no DOM, no rendering.

Swap RAW in the module for a real profile — name, calls, self ms, and a bound per frame — and the whole piece re-costs itself.

Gotchas