0
Challenge · 69Architecture & State
Debouncing
Perfused in ~60% of apps
A search box that fires a request on every keystroke sends r, re, rea, reac, react — five calls for one search. Debouncing waits until the user stops typing, then acts once. It is the single most-asked performance pattern for search-as-you-type.
Core idea. Debouncing delays an action until the input has been quiet for a set time; each new event cancels the pending action and restarts the timer, so only the FINAL event in a burst actually runs.
poke it, drag it,
try to break it
try to break it
no slides here.
you drive.
you drive.
Playground, this isn't a screenshot
SEARCH AS YOU TYPE — TYPE FAST
raw (state)every keystroke
—
naive: 1 request per keystroke
debounced (after 600ms)settled
—
0
keystrokes
0
naive requests
0
debounced requests
requests actually sent to the API
none yet — type, then pause for 600ms
delay
Type quickly: raw changes on every key, but debounced only updates once you pause. That single update is the only request you'd send.
↑ play a little first, then dig in