Comment by kevingadd

Comment by kevingadd 13 hours ago

9 replies

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.

wffurr 8 hours 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 8 hours ago

    Yes, that's right. I'm hoping there will be a way to do this in a future revision of Wasm GC.

refulgentis 11 hours ago

I'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.

  • stiles11 2 hours ago

    What's the name of the app I want to try it out

  • lukasb 10 hours ago

    When you said "jump in perceived latency", did you mean perceived latency went up or down?

  • ripped_britches 9 hours ago

    Which libraries caused these problems for you?

    • refulgentis 9 hours ago

      Don'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.