4 ms·
It's sort of baffled me that people appear to be shipping real code using WasmGC since the limitations described in this post are so severe. Maybe it's fine bec
by kevingadd 2y ago
It's sort of baffled me that people appear to be shipping real code using WasmGC since the limitations described in this post are so severe. Maybe it's fine because they're just manipulating DOM nodes? Every time I've looked at WasmGC I've gone "there's no way I could use this yet" and decided to check back a year later and see if it's There Yet.
Hopefully it gets there. The uint8array example from this post was actually a surprise to me, I'd just assumed it would be efficient to access a typed array via WasmGC!
Beyond the limitations in this post there are other things needed to be able to target WasmGC with existing stuff written in other languages, like interior references or dependent handles. But that's okay, I think, it can be worthwhile for it to exist as-is even if it can't support i.e. existing large-scale apps in memory safe languages. It's a little frustrating though.
- refulgentis 2y agoI've been shipping a Flutter app that uses it for months. Pretty heavy stuff, its doing everything from LLM inference to model inference to maintaining a vector store and indexeddb in your browser. Frame latency feels like it's gone, there's 100% a significant decrease in perceived latency. I did have a frustrating performance issues with 3rd party code doing "source code parsing" via RegEx, thought it was either the library or Flutters fault, but from the article content, sounds like it was WASM GC. (saw a ton of time spent converting objects from JS<->WASM on a 50 KLOC file) From that perspective, the article sounds a bit maximalist in its claims, but only from my perspective. I think if you read "real time graphics" as "3d game" it gives a better understanding of where it's at, my anecdata aside.
- lukasb 2y agoWhen you said "jump in perceived latency", did you mean perceived latency went up or down?
- refulgentis 2y agoDown, significantly
- ripped_britches 2y agoWhich libraries caused these problems for you?
- refulgentis 2y agoDon't wanna name names, because it's on me, it's a miracle it exists, and works. I don't think there's a significant # of alternatives, so hopefully Flutter syntax highlighting library, as used in a package for making markdown columns, is enough to be helpful. Problem was some weird combo of lots of regex and an absolutely huge amount of code. It's one of those problems it's hard for me to draw many conclusions from: - Flutter may be using browser APIs for regex, so there's some sort of JS/WASM barrier copying cost - The markdown column renderer is doing nothing at all to handle this situation lazily, i.e. if any portion of the column is displayed, syntax highlighting must be done on the complete markdown input - Each different color text, so pretty much every word, gets its own object in the view hierarchy, tens if not hundreds of thousands this case. Can't remember if this is due to the syntax highlighting library or the markdown package - Regex is used to parse to code and for all I know one of them has pathological performance like backtracking unintentionally.
- stiles11 2y agoWhat's the name of the app I want to try it out
- azakai 2y agoDefinitely a lot is missing, yeah, and adding more will take time. But it works well already for pure computational code. For example, Google Sheets uses WasmGC for Java logic: https://web.dev/case-studies/google-sheets-wasmgc#the_final_result https://web.dev/case-studies/google-sheets-wasmgc#the_final_...
- wffurr 2y ago>> The uint8array example from this post was actually a surprise to me, I'd just assumed it would be efficient to access a typed array via WasmGC! The problem is that the Scheme i8 array is not actually a UInt8Array with WasmGC. It’s a separate heap allocated object that is opaque to the JS runtime. In the linear memory Wasm model, the Scheme i8 array is allocated in the wasm memory array, and so one can create an UInt8Array view that exactly maps to the same bytes in the linear memory buffer. This isn’t possible (yet?) with the opaque WasmGC object type.
- davexunit 2y agoYes, that's right. I'm hoping there will be a way to do this in a future revision of Wasm GC.
- mickael-kerjean 2y agoI'm a happy wasm user, last week I was looking at adding support for psd file on my app [1], the choices was in between using a full js lib that is almost 1MB large, doesn't work very well and is slow OR leverage some C stuff. Without any kind of optimisation, the wasm version is 10 times faster and 5 times smaller and that's before digging through SIMD. There will always people complaining about a lot of things but wasm is already fine enough for a lot of use cases [1] https://github.com/mickael-kerjean/filestash https://github.com/mickael-kerjean/filestash
- davexunit 2y agoHope my post didn't come across as complaining because I agree! Wasm is great right now for lots of things, just wanted to highlight a use case that isn't great yet.