News for hackers. Stuff that matters.
Re:Preact rendering in a web worker by developit on Monday December 05, 2016 @11:21AM (#13106480)
Agreed. Someone submitted this before I got around to writing that post, heh. Synopsis: fake DOM in the worker w/ MutationObserver that sends batched changes up to the UI thread. Event delegation to get things back into the worker. It's actually relatively straightforward, demo code is a mess though.
Re:Preact rendering in a web worker by axemclion on Monday December 05, 2016 @03:45PM (#13109353)
There are a bunch of other complexities too - things like

(1) cancelling events which are synchronous, but web worker communication is async

(2) What is the best serialization format ? I found JSON.stringify to be the fastest, but how to compress data better ?

(3) How to batch the operations when you want to send info over from worker to the UI thread. The batch size should be small enough that it runs in 16ms, but large enough that you don't waste frame cycles.

(4) Figuring out if it makes sense to spawn multiple workers to diff parts of the VDOM tree - similar to React Fiber