Technology Quote by Eric Freeman
““When you pass zero to setTimeout, you’re asking JavaScript to run your timeout handler as soon as it possibly can — and this leads to your handler running as frequently as it possibly can.””
About This Quote
Source Talk: JavaScript Performance, 2015
Setting zero delay in setTimeout causes the callback to execute as fast as the event loop permits, often leading to excessive, uncontrolled executions.
In simple terms: Zero delay makes the function run as often as possible.
Avoid zero delay; use requestAnimationFrame or throttling.
Themes
Mood
Type
When to use this quote
- UI animations
- data polling
- real‑time updates
- debounce implementations
Key Concepts
Questions to Reflect On
- Do you need that frequency?
- Could a lower frequency suffice?
Zero delay can still block the main thread and cause jank.