Lab · 02 of 4

Fewer, faster requests

02 · Fewer, faster requests

Less traffic, instant feel.

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
keysAPI11 keys → 3 callsWhile the user keeps typing, at most one request goes out per window.
02 · DebounceWait for the pause
keysAPIwait 300ms7 keys → 1 callThe timer restarts on every key. Only when typing stops does one request go out.
03 · PrefetchLoad before the click
idle✓ shown in 0msHovering 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 control
0 calls
Throttlemax 1 per wait
0 calls
Debounceafter you pause
0 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.
Healing
Alchemist's potion12 gold
Dot: grey = not loaded · amber = loading · light = ready
Last switch—
Total waited0.0s
Network