mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-29 07:04:09 +08:00
clearTimeout/clearInterval, refresh, ref/unref and hasRef scanned the whole timer heap for the handle, so arming and clearing many timers was quadratic (1e5 cancels: 1.0 s vs Node 46 ms). An id-to-slot hash kept exact by every heap write makes the lookup O(1); heap order is unchanged.