W3C home > Mailing lists > Public > public-web-perf@w3.org > July 2011

Re: [Efficient Script Yielding] - Clamping

From: Ian Hickson <ian@hixie.ch>
Date: Sun, 3 Jul 2011 00:02:08 +0000 (UTC)
To: James Robinson <jamesr@google.com>
cc: public-web-perf@w3.org
Message-ID: <Pine.LNX.4.64.1107030000060.20871@ps20323.dreamhostps.com>
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

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:04:31 UTC