Lab · 02 of 4
02 · Fewer, faster requests
Three front-end habits that cut wasted requests and hide latency. Throttle and debounce a search box in the market, then prefetch potions so switching between them feels instant.
01 · ThrottleOne call per window
While the user keeps typing, at most one request goes out per window.02 · DebounceWait for the pause
The timer restarts on every key. Only when typing stops does one request go out.03 · PrefetchLoad before the click
Hovering a variant starts loading it, so by the time the user clicks it is already there.Try it · SearchDebounce vs throttleEvery keystroke in a search box could be an API call. Debounce waits until you stop typing for 300ms. Throttle lets one call through every 300ms while you type. Type below, or let it auto-type.
Wait
Every keystrokeno control0 calls
Throttlemax 1 per wait0 calls
Debounceafter you pause0 calls
Last debounced query: —Start typing
Try it · ShopPreload on intentThe page has already loaded. Each potion variant costs a 900ms request. Without preloading you wait on every click. Prefetch on hover, or quietly after the page goes idle, and the switch feels instant.
Alchemist's potion
12 gold
Dot: grey = not loaded · amber = loading · light = ready
12 goldLast switch—
Total waited0.0s
Network