0
Challenge · 70Architecture & State

Throttling

Perfused in ~40% of apps

A scroll handler can fire 60+ times a second. If each one runs a layout calculation or a setState, you jank the page. Throttling caps it: the handler runs at most once per interval — say every 150ms — so the UI keeps updating smoothly while the events keep flooding in.

Core idea. Throttling enforces a maximum rate: no matter how many events arrive, the action runs at most once per interval, steadily, WHILE the stream continues — unlike debounce, which waits for the stream to stop and then runs once.
Playground, this isn't a screenshot
CONTINUOUS EVENT STREAM (like a scroll / mousemove drag)
raw eventsone tick per event
events will appear here as they stream
throttlefires at most once / 500ms — DURING the stream
debouncefires once, 500ms AFTER the stream stops
0
raw events
0
throttle fires
0
debounce fires
interval / wait

Press fire a burst: throttle ticks at a steady max rate while events stream; debounce stays silent and fires once, only after the stream stops.

↑ play a little first, then dig in