GoogleChromeLabs / css-paint-polyfill

CSS Custom Paint / Paint Worklet polyfill with special browser optimizations.
https://googlechromelabs.github.io/css-paint-polyfill/
Apache License 2.0
740 stars 21 forks source link

Off main thread #14

Open Mapiac opened 4 years ago

Mapiac commented 4 years ago

The docs on this are a bit old and even new ones from Sept say 'we are working on getting paintAPI pant worklets off the main thread.' Is there an update on there this is at? Can we use in production with a pollyfill for Safari? Thanks.

developit commented 4 years ago

@Mapiac Paint Worklet runs Off Main Thread (on the compositor thread) as of Chrome 81: https://twitter.com/DasSurma/status/1225106581517299712

There are a number of folks using this polyfill in production. In most cases the polyfill's performance matches or exceeds direct <canvas> usage: the polyfill uses clever hacks in Firefox and Safari that let it draw to multiple locations without image encoding/decoding overhead.

That being said, there are a couple wins still to be had: once Firefox lands support for OffscreenCanvas, the polyfill can detect and use that to decouple paint framerate from the page.