Debounce & Throttle
Optimize performance by controlling function execution rate
Key Concepts
Debounce
Delays function execution until after user stops typing/acting for specified time. Perfect for search inputs, form validation.
Throttle
Ensures function executes at most once per specified time period. Great for scroll events, window resize, button clicks.
1. Debounce Demo - Search Input
Type to search. API calls happen only after you stop typing for 500ms.
Keystrokes
0
API Calls
0
Saved Calls
0
2. Throttle Demo - Button Clicks
Click rapidly. Throttled handler executes max once per second.
Total Clicks
0
Throttled Executions
0
3. Throttle Demo - Scroll Events
Scroll in the box below. Throttled handler executes max once per second.
Scroll item #1
Scroll item #2
Scroll item #3
Scroll item #4
Scroll item #5
Scroll item #6
Scroll item #7
Scroll item #8
Scroll item #9
Scroll item #10
Scroll item #11
Scroll item #12
Scroll item #13
Scroll item #14
Scroll item #15
Scroll item #16
Scroll item #17
Scroll item #18
Scroll item #19
Scroll item #20
Scroll item #21
Scroll item #22
Scroll item #23
Scroll item #24
Scroll item #25
Scroll item #26
Scroll item #27
Scroll item #28
Scroll item #29
Scroll item #30
Scroll item #31
Scroll item #32
Scroll item #33
Scroll item #34
Scroll item #35
Scroll item #36
Scroll item #37
Scroll item #38
Scroll item #39
Scroll item #40
Scroll item #41
Scroll item #42
Scroll item #43
Scroll item #44
Scroll item #45
Scroll item #46
Scroll item #47
Scroll item #48
Scroll item #49
Scroll item #50
Total Scroll Events
0
Throttled Executions
0
💡 When to use:
Debounce:
- • Search autocomplete
- • Form validation
- • Resize end detection
- • Save draft functionality
Throttle:
- • Scroll events
- • Window resize
- • Mouse move tracking
- • Button spam prevention