W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2013

Re: [whatwg] Canvas in workers

From: Glenn Maynard <glenn@zewt.org>
Date: Wed, 16 Oct 2013 11:50:13 -0500
Message-ID: <CABirCh8S0Z7_gKLGtA+V+kepxYi3mhh8ZMFG5dTHeuWtb_59yQ@mail.gmail.com>
To: Justin Novosad <junov@google.com>
Cc: WHATWG <whatwg@whatwg.org>, Kyle Huey <me@kylehuey.com>, David Bruant <bruant.d@gmail.com>, Robert O'Callahan <robert@ocallahan.org>
On Wed, Oct 16, 2013 at 8:01 AM, Justin Novosad <junov@google.com> wrote:

> > ... oh... so the UI could be updated even if JS is blocking... the future
>
> is bright :-)
> >
>
> If the UI is all painted in a canvas, then yes.
>
> Let's not get ahead of ourselves though. Browsers that have a compositor in
> a separate thread can present frames without synchronizing with the main
> thread, but updating a regular (DOM-based) UI would likely require style
> and layout calculations to be propagated from the main thread to the
> compositor.


Right, that's the only sort of async update we're talking about here:
changing what gets composited, and not anything that affects layout or is
detectable by scripts.

But actually, there's no disagreement.  I misread Kenneth's mail as saying
"your proposal requires synchronization with the main thread", but he
actually said "this other proposal requires synchronization with the main
thread (but has other benefits)".

I'm not sure how big a problem that synchronization will be.  Posting
messages should be extremely cheap: essentially free, when you're just
transferring an object to a thread in the same process.  The UI thread
should also not be heavily loaded: you shouldn't have to wait long for the
script to receive the object and push it into the canvas.  But, even a cost
of 2ms would be a massive hit, since that's 12% of the time you have
available when rendering at 60 FPS.  In practice it might make it harder to
sustain smooth 60 FPS animation.  For example, if the main thread
occasionally spends 4ms doing GC work, you may have a rendering hitch that
you wouldn't have otherwise.

-- 
Glenn Maynard
Received on Wednesday, 16 October 2013 16:50:40 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:12 UTC