Re:Windows Timer Resolution: Megawatts Wasted
by personalcompute on Tuesday July 09, 2013 @11:59PM
(#6017374)
Any timer is constrained to the resolution set by the system timer. To go lower one would require something akin to a spin-loop, which defeats any gain by keeping the resolution high.
Re:Windows Timer Resolution: Megawatts Wasted
by mischanix on Wednesday July 10, 2013 @01:42AM
(#6017677)
setTimeout(,0) is a special case. It means "make this function be ran after the current call stack clears". That requires neither a timer nor a spin loop.
Re:Windows Timer Resolution: Megawatts Wasted
by pcwalton on Wednesday July 10, 2013 @02:28AM
(#6017820)
If browsers did that they would break the Web. They must clamp to some low delay (4 ms, I believe) or else some pages will lock up.
Re:Windows Timer Resolution: Megawatts Wasted
by mischanix on Thursday July 11, 2013 @12:44AM
(#6024498)
Right, but that precedent was only set by incorrect implementations existing in the first place. Using setTimeout(,0) recursively in lieu of (a then unavailable) requestAnimationFrame or a non-zero timeout period is in my mind equivalent to while(true){}/infinite tail recursion.
Re:Windows Timer Resolution: Megawatts Wasted
by mischanix on Thursday July 11, 2013 @03:54AM
(#6024939)
And yes, in the HTML5 spec (years later), it was standardized to a 4ms clamp, also because of the incorrect implementations prior.
Probably heaps, but why would that cause the system-wide timer to run more frequently? Even if it does need to it should only be temporary.