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

Re: Open Source Cross-Browser setImmediate in JavaScript

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Thu, 07 Jul 2011 11:37:03 -0400
Message-ID: <4E15D29F.7040501@mit.edu>
To: public-web-perf@w3.org
On 7/7/11 10:11 AM, Paul Bakaus wrote:
> That's the thing  I'm wondering out the same thing, so I'd love to know
> where the difference really is. setTimeout often feels to slow  for
> instance, to start or restart CSS animations or transitions, you have to
> wait for a relayout, which is where I'm using setTimeout.

Of course that doesn't actually work correctly, per 
unless you use a pretty long timeout value...

> My guess is that setImmediate wouldn't wait for layout batches to be
> finished, but only JS

If it's running on the same event loop as layout (which as far as I can 
tell it is), then it would have to wait for layout to not be running.

> so you might call it while code is executing and
> would know it's executed right after the rest of your current stack has
> been worked off, but before layout changes.

I don't think it offers any such guarantees.  Certainly not as currently 

Note that layout can change synchronously if something flushes it, by 
the way, so there's no async setup that can guarantee running before 
layout changes.

Received on Thursday, 7 July 2011 15:37:32 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:01:08 UTC