Hellow Coders
When I came to know about throttling and debouncing, I would often get confused between them. In this article, I will explain the differences between debouncing & throttling. If you don’t know what is debouncing or throttling, I would recommend you to read my article on debouncing & throttling before proceeding further.
Let’s See The Difference Between Debouncing & Throttling
Debouncing
- Debounce Make Sure That Function Won’t Be Called Until Specified Time
- For Example If A User Continuesly Clicks The Button You Only Call Original Function After The Last Click Or Difference Between Two Click IS More Than Specified Delay.
- Debouncing Is Used In Input Validation Where You Triggers Validation Only After The Last KeyPress Event Occures
- Groups Multiple Function Call To Single One.
Throttling
- Throttling Ensures A Number Of Times Function Will Be Called In Given Interval
- For Example If A User Continuesly Clicks The Button You Only Call Original Function Once Every Specified Time
- Throttling Is Used When User Changes Screen Size Or Scroll Events Where You Limit Number Of Execution In Specified Interval.
- Ensures Regular Function Call Every Given Milliseconds.
End Note :
I hope now you have a better understanding of debouncing & throttling. Let me know in the comment below other differences you know.