Skip to content

Debounce vs Throttle

While both patterns rate-limit function calls, they have different behaviors and use cases.

FeatureDebounceThrottle
FiresAfter events stopAt regular intervals
Use caseSearch, validationScroll, resize, game loop
First executionAfter delay (or leading)Immediately
ResultSingle executionRegular executions
sequenceDiagram
participant Events as Events
participant Debounced as Debounced
participant Throttled as Throttled
Note over Events: User types quickly
Events->>Debounced: 1
Events->>Debounced: 2
Events->>Debounced: 3
Events-->>Debounced: (WAITING...)
Debounced-->>Events: Executes once
Note over Events: Window scrolls rapidly
Events->>Throttled: 1
Events-->>Throttled: (waiting)
Events->>Throttled: 2 ✅
Events-->>Throttled: (waiting)
Events->>Throttled: 3 ✅
  • Debounce: When you only care about the final state after rapid events stop (search, validation)
  • Throttle: When you need regular updates during rapid events (scroll progress, mouse position)
PatternBehaviorBest For
DebounceExecutes after pauseSearch, autocomplete, resize
ThrottleExecutes at intervalsScroll, mouse tracking, game input
Leading debounceExecutes immediately, then debouncesSave buttons, form submit