This is a question about JavaScript internals.
Lets say I have 10 async tasks that all take x number of seconds to run. Whilst waiting for a response the script is idle.
In the background the JavaScript engine is asking "Is there anything on the task queue". To my understanding this is a loop. Hence, event loop. I know in Node this is implemented with Libuv. I've read this article which explains a little: https://nikhilm.github.io/uvbook/basics.html
Do JavaScript engines place any restriction on how often this event loop runs in order to balance out performance of the application? Does it run at a set interval?
If I'm off with anything, please correct me. I was purely interested at what interval this event loop runs.
setTimeout
has a minimum timeout of 4ms, not because the event loop is too slow. – LookeronsetTimeout()
etc depends on the granularity of your OStick
(it's calledjiffy
on Linux) on some OSes like linux you can actually configure it - lots of real-time embedded systems run Linux on a much faster tick so js timers can run at much finer granularity – Pd