Reputation: 21
I am analyzing performance of existing UI application using Chrome developer tool and have noticed a really strange behavior - from time to time (about 5-10%) browser just idles before executing the script from setTimeout(). I've googled a lot, and I've found a lot of answers that browser puts the script into the end of queue, so it waits until all other tasks are finished.
Yes, but it waits a lot more! From 10ms to 800ms more!
Chrome performance tool
The code which sets this timeout looks pretty much like: y.setTimeout(a, 0)
Is it a Chrome 65 issue?
Is it real or can be seen only in developer tool?
Is there a way to eliminate this and force script to execute ASAP after the time has come (in this case - immediately after other tasks have been finished)?
Upvotes: 1
Views: 81
Reputation: 21
Found an answer in related question: this happens when tab is inactive, because timers in inactive tabs fire once a second, so waiting "overhead" is floating from 0 to 1 second. Feels like not a real performance problem for users, but a real problem for our performance measurements...
Upvotes: 1