Re: [Efficient Script Yielding] - Clamping

On Sat, 2 Jul 2011, James Robinson wrote:
>
> Read the spec. setTimeout() is only clamped when nested, that is the 
> clamp only applies when setTimeout() is invoked within the context of 
> another timer firing.

...and it's only there because UAs found that authors did tight loops and 
the only way to handle those without pegging the CPU pointlessly was to 
have a delay on repeat timers, which I'm sure will happen for 
setImmediate() as well. However, if that's no longer a concern, then we 
can certainly try changing the setTimeout() rules to not clamp, or to do 
something more clever (e.g. exponential backoff, or only clamping if the 
timer didn't take long to execute, indicating it's not an attempt to 
yield, or some such).

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Sunday, 3 July 2011 00:02:32 UTC