es-toolkit icon indicating copy to clipboard operation
es-toolkit copied to clipboard

Debounce optimization

Open rhysbrettbowen opened this issue 5 months ago • 0 comments

It's a little old but you might want to take a look at https://modernjavascript.blogspot.com/2013/08/building-better-debounce.html (I wrote many moons ago). Saw es-toolkit and thought about it. lodash and underscore both use this method now (instead of clearing the timeout on every schedule, wait for the original timer to finish before creating a new one with the time left from the last schedule). That makes things a lot faster for many debounce calls as it doesn't have to create a new frame for each schedule.

rhysbrettbowen avatar Jun 25 '25 17:06 rhysbrettbowen