289 karma · joined October 15, 2017
FYI: AsyncTask and MicroTask are equivalent, and so are my task() function and your OnMessageTask
Domenic and I have been working on a proposal[1] called Blöcks to introduce transferable functions to JavaScript.
In the meantime, I wrote Clooney[2] ontop of Comlink[3] that gives you almost that.
[1]: https://github.com/domenic/proposal-blocks
Since Wasm is synchronous, I’d say it should almost always be run in workers except if the module needs access to some main-thread-only API.
Since I mostly use rollup, I ended up writing a plugin[1] that allows you to pretend that modules are in workers. It compiles down to AMD under the hood and uses a very minimalistic worker.
That being said, I think even smaller-scale things like state management and hitting APIs should be moved to workers. It all increases resilience and buys headroom for low-end phones.
When you say, “this site”, do you mean my blog? Because that one’s fully static using 11ty.
I am saying that we should be using web workers to keep the main thread free. That is completely orthogonal to good static design, proper bundling, right caching headers, code splitting, asset hashing etc etc.
That being said, in all the off-main-thread apps I have written so far, the cost of structured cloning was pretty much irrelevant.
The article is mostly aimed at use-cases where some sort of logic in JavaScript is required.
And definitely agree with the shout-out to Twiggy (which I mention in the previous post in the series)!
I’ll definitely give tiling a spin (although at this point we are definitely fast enough™️)
The point of the structured clone algorithm is to make values transferable to other realms, so functions are actively ignored. Most of the time, I think that is “good enough”.
Houdini is a task force that consists of people from Apple, Mozilla, Microsoft, Chrome, even IBM and Samsung. It’s by no means a Chrome-only thing or us being pushy.
Servo has an experimental implementation, but it’s the part of Servo that hasn’t been merged into FF. All participating browser vendors have given very positive signals about CSS Paint API.
Check http://ishoudinireadyyet.com/ to stay up to date :)
You absolutely have a point. Ben Kelly from Mozilla pointed out to use that their workers are _much_ cheaper than ours. We apparently never invested much time in optimizing Workers as they are rarely used.