Skip to main content

Async and Performance

15th October, 2022

Updated: 15th October, 2022

    What if there are already 20 items in the event loop at that moment? Your callback waits. It gets in line behind the others -- there's not normally a path for preempting the queue and skipping ahead in line. This explains why setTimeout(..) timers may not fire with perfect temporal accuracy. You're guaranteed (roughly speaking) that your callback won't fire /before/ the time interval you specify, but it can happen at or after that time, depending on the state of the event queue.


    Created on: 15th October, 2022

    Last updated: 15th October, 2022


    Tagged With: