Difference between debounce and throttle

Primož Hadalin
Oct 2, 2017 · 1 min read

Debounce is like hitting the snooze button on your alarm clock. You are trying to wake up, but you’re just not there yet. Debounce is you saying not yet, not yet, not yet — and this could go on forever. Theoretically you might never wake up. A real world example might be preventing a chart from being redrawn while the window is resized by some maniac who has nothing better to do than expand and shrink his browser incessantly for five minutes. Only when the activity stops for, say, two seconds will the chart be redrawn.

With throttling, on the other hand, something will happen every so often. Let’s say the maniac above decides to click a button that reloads the chart over and over again putting a strain on your backend. With throttle, the data would be fetched from the backend, but only every ten seconds.

Thanks to Rafael Rosengarten for reading drafts of this.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store