S
Surma
dassur.ma · Personal blog · on HN since 2017
Surma, a Google web developer advocate, writes about web performance, WebAssembly, web workers, and JavaScript tricks.
What HN saysHN links it for practical WebAssembly guidance, such as compiling C without Emscripten, and for Comlink and off-main-thread work.
19HN people shared it
3linked it in comments
19stories submitted
680story points
5 years agolast shared
2017people per year2026
Most-shared posts
- 1Is PostMessage Slow?4 people · 7 points · first shared 2019 · discussion on HN
- 2Compiling C to WebAssembly Without Emscripten2 people · 225 points · first shared 2019 · 35 comments on HN
- 3DOM2Texture: Abusing Arcane APIs2 people · 9 points · first shared 2017 · discussion on HN
- 42018: 120fps and no jank2 people · 4 points · first shared 2017 · discussion on HN
- 5React and Redux and Comlink = Off-Main-Thread2 people · 2 points · first shared 2019 · discussion on HN
- 6My most useful RegExp trick2 people · 2 points · first shared 2018 · discussion on HN
- 7When to use web workers1 people · 257 points · first shared 2019 · 107 comments on HN
- 8Deep-copying in JavaScript1 people · 166 points · first shared 2018 · 132 comments on HN
- 9The 9am rush hour (why JavaScript is a performance bottleneck)1 people · 2 points · first shared 2018 · discussion on HN
- 10Case study: Moving a Three.js-based WebXR app off-main-thread1 people · 2 points · first shared 2020 · discussion on HN
- 11Nice overview on how to http/2 all the things1 people · 2 points · first shared 2017 · discussion on HN
- 12An Actor, a model and an architect walk onto the web1 people · 1 points · first shared 2018 · discussion on HN
- 13How to read web specs1 people · 1 points · first shared 2017 · discussion on HN
What HN people wrote when they linked it
tjelen · 2020-02-25
Isn't it already supported backend in LLVM?
https://github.com/llvm/llvm-project/tree/master/llvm/lib/Target/WebAs…
I mean it is still under development but I think it is usable. Here's a quick intro I found some time ago: https://dassur.ma/things/c-to-webassembly/
fold_left · 2019-08-24
> From what I've heard WASM isn't a viable alternative in the first place. It's good for compute-heavy tasks, but the overhead involved in going from browser to native to browser is too much to make WASM an alternative to what JavaScript is usually used for -- rendering interfaces and making pages interactive.
I don't think that's the case anymore: https://dassur.ma/things/is-postmessage-slow/
rektide · 2022-01-20
It's not oriented specifically at state-sync'ing, but Comlink[1] comes to mind.
> Comlink.wrap(endpoint) and Comlink.expose(value, endpoint?) Comlink’s goal is to make exposed values from one thread available in the other. 'expose' exposes 'value' on endpoint, where endpoint is a postMessage-like interface. 'wrap' wraps the other end of the message channel and returns a proxy. The proxy will have all properties and functions of the exposed value, but access and invocations are inherently asynchronous. This means that a function that returns a number will now return a promise for a number.
Creating & exposing an EventEmitter in the main thread then proxy'ing it on each other thread ought create a reasonably similar experience to this Tangle library. The docs themselves discuss some of the extra difficulties if one is trying to proxy DOM Events[2], talking about this as a common usage pattern, but which is complicated by DOM Events not being cloneable.
For another example of Comlink in action, there's this blog post on using Redux across threads[3].
[1] https://www.npmjs.com/package/comlink
[2] https://github.com/GoogleChromeLabs/comlink#transfer-handlers-and-even…
[3] https://dassur.ma/things/react-redux-comlink/