The timer clamp counts depth, not breadth
breadth
Siblings from one task
setTimeout(a, 0) ×12
ordinary task
level 0
timer
0ms
timer
0ms
timer
0ms
12 of these fired inside 0.3ms total.
depth
Each timer schedules the next
function tick(){ setTimeout(tick, 0) }
ordinary task
level 0
timer
levels 1–6 · 0ms
timer
level 7+ · ~4.5ms
…and every one after it
Any self-rescheduling loop is this shape, even when it reads as flat.
Hover any box. Both columns schedule with
setTimeout(fn, 0)
; only the chain gets clamped.
Gaps measured between consecutive callbacks in Chrome 153.