News for hackers. Stuff that matters.
Re:WASM: Big Deal or Little Deal? by 3cats-in-a-coat on Monday September 04, 2023 @09:32PM (#37386887)
We didn’t need wasm to compile to the web for decades prior. Having a target closer to machine code is good, but not revolutionary. Same for Photoshop on the web tbh. Who is even using this?
Re:WASM: Big Deal or Little Deal? by afavour on Monday September 04, 2023 @09:59PM (#37387037)
You’re asking who is using Photoshop on the web? A lot of people. Like there’s a ton of people using Office 365 in a browser rather than the native app.

HN loves to shit on webapps and honestly with very good reason but the reality is that for a lot of people a cloud-based app they can use on absolutely any computer (or, often, phone/tablet) they can get their hands on is a huge boon.

Re:WASM: Big Deal or Little Deal? by 3cats-in-a-coat on Monday September 04, 2023 @11:48PM (#37387633)
Absolutely any computer/phone/tablet has the concept of applications.

Web apps remove initial friction of installation, and for big apps not even that much because you still need to download it and run it. But they also pay up this gain, with huge interest, for every single second you use the app. This is not benefitting the users. The bottom line is dire.

However removing initial friction is all about getting your foot in the door. It's like selling a printer under cost and then you get them with the ink. Get them the first drug dose free, and then you get them when they're dependent. Offer a cheap design, and then you destroy them with the manufacturing.

A story as old as the world, of which this "web megaapp" model is a tiny microcosm of. The web is an excellent platform for small to medium apps. Photoshop is gigantic. And Figma and the other rest of its ilk are absolutely insufferable and I'm saying this as a webdev. I would be significantly happier if these products did NOT exist.

Heck if we took out WASM and these kind of products went away I'd consider it a net positive.

Re:WASM: Big Deal or Little Deal? by pjmlp on Tuesday September 05, 2023 @05:18AM (#37389575)
Android instant apps do exactly the same nowadays.
Re:WASM: Big Deal or Little Deal? by mfer on Monday September 04, 2023 @10:02PM (#37387058)
WASM is very useful for things outside the web.

Consider that a WASM build can be run server side on multiple OS and arch. The same build. The API can be controlled and locked down (think security).

The web is not the most interesting place for WASM.

Re:WASM: Big Deal or Little Deal? by 3cats-in-a-coat on Tuesday September 05, 2023 @02:09AM (#37388399)
You can also run the same build when there's no OS fragmentation. Say all Windows machines run the same build. All iPhones run the same build (well not quite, but let's say they automated and hid the builds very efficiently on the App Store, zero effort). All in all, builds are not a problem. If they're a problem, it's a symptom of a fragmented, immature ecosystem, which indeed many Linux/BSD distros continue to be, in the big picture.

However none of this matters. Because we have Java and countless other cross-platform runtimes. WASM is at best just another variation on the same theme thrown in the same pool. I definitely see how one could justify WASM hype by saying all the things will be WASM because it's so sandboxed and multiplatform. But that's the engine of all hype cycles. Truth is it likely won't happen, because WASM is nothing new and nothing unique. That niche is filled with solutions already.

We could theorize everyone will have a WASM compiler backend because it runs in browsers, therefore it'll become more useful on servers as you have compiler backend for everything to WASM. However YOU yourself said the web is not the most interesting place for WASM. So what will supposedly drive the WASM ecosystem, that makes it interesting (the web) isn't interesting, but it has to be interesting so the server use of WASM becomes more interesting. Quite the chicken egg problem there. Might work, might not.

I lived through a period on the web when every language had a JS compiler backend. You could compile Java to JS, Delphi to JS, C# to JS and so on. Maybe some of those solutions still exist in some half-dead form, but they're largely abandoned, because people realized the best language to write JS in... is JS. This is also why TypeScript has such success, because it's JavaScript itself (but with types).

For WASM we can argue there's no such pressure to "write JS in JS" but there's just very little value for it, outside the nerd realm of "OMG assembly on the web". I know why Google wants it. It wants it because it indexes the web, and puts ads on the web, and so therefore it wants everything to be the web, because then it means Google can index and put ads on everything. That's good for them, but not for anyone else. Downloading and running hundreds of MB of code for an app like Photoshop, or whatever, over the web is an absolutely miserable experience. Not to mention the HCI input capabilities and OS services available to the app, which are understandably limited in a browser.

Re:WASM: Big Deal or Little Deal? by robertlagrant on Tuesday September 05, 2023 @04:54AM (#37389392)
> All in all, builds are not a problem. If they're a problem, it's a symptom of a fragmented, immature ecosystem, which indeed many Linux/BSD distros continue to be, in the big picture.

Can you give an example of how builds are a problem due to Linux/BSD distros?

Re:WASM: Big Deal or Little Deal? by 3cats-in-a-coat on Tuesday September 05, 2023 @07:26AM (#37390302)
They aren't? Well I guess then WASM doesn't matter, as there's no problem to solve.
Re:WASM: Big Deal or Little Deal? by robertlagrant on Tuesday September 05, 2023 @07:45AM (#37390428)
I think you mis-read my question.
Re:WASM: Big Deal or Little Deal? by 3cats-in-a-coat on Tuesday September 05, 2023 @10:32AM (#37392220)
Maybe, but there's either a problem with builds, which makes WASM a potentially exciting solution to them, or there isn't, and therefore the subject is not relevant to WASM in this thread.
Re:WASM: Big Deal or Little Deal? by pjmlp on Tuesday September 05, 2023 @05:19AM (#37389586)
Just like plenty of bytecode formats that have been invented since 1960, while doing it worse than Java, .NET and BEAM.
Re:WASM: Big Deal or Little Deal? by matthewowen on Monday September 04, 2023 @10:16PM (#37387122)
Figma is built using WASM, sees significant benefit from it, and is pretty popular.

But absolutely there are a lot of of less demanding web applications out there that don’t need this. And in the case of Figma, it’s the core of the application that uses WASM, with the more webby UI bits outside of it for all the devex reasons you’d expect.

In truth it’s a medium deal in the sense that it enables use cases that simply aren’t feasible without it, but is arguably irrelevant for most “conventional” web dev problems.

In that vein I’d argue it is more relevant for use cases that currently aren’t on the web at all versus as an improvement for those that are.

Re:WASM: Big Deal or Little Deal? by 3cats-in-a-coat on Monday September 04, 2023 @10:45PM (#37387285)
I can’t stand Figma, it’s limited, slow and in general, demonstrating nothing at all for its wasm use so that’s kind in support of my point. Something like Figma would get a lot more performance out of using WebGL. Which is only accessible through JS, and the emscripten bindings for it go through JS calls. So WASM is kind of a dead weight in this scenario.
Re:WASM: Big Deal or Little Deal? by paulgb on Monday September 04, 2023 @10:56PM (#37387338)
The company was last valued at $20B so they are doing something right.

They are using WebGL. Using WebGL from WebAssembly has some nice advantages; with Wasm you can use languages that are more accommodating to the sort of densely-packed data that you need to send to GPU buffers.

Here’s an interview I did with a raster graphics editor that touches on why they use Wasm for GPU. https://digest.browsertech.com/archive/browsertech-digest-ho...

Re:WASM: Big Deal or Little Deal? by 3cats-in-a-coat on Monday September 04, 2023 @11:25PM (#37387488)
Accommodating how? Everything goes through JS, what they share is basically an ArrayBuffer (if we're talking command buffers) which you can build directly in JS with the same JIT backend that powers WASM. I went through your article but it doesn't describe how is WASM more "accomodating" to this.

One way or another, the command buffers are an encoding process. They're not WASM code nor JS code, they're GPU code. You need to build them from one platform for another platform. There's no any direct correspondence between WASM and WebGPU, let alone WebGL.

Re:WASM: Big Deal or Little Deal? by paulgb on Tuesday September 05, 2023 @06:12AM (#37389886)
Accommodating in the sense that in a language where you control the memory layout of objects, you don’t have to explicitly do an explicit encoding step, you can just specify a memory layout that the GPU can understand. This makes it a lot nicer to work with in my experience.

Here’s an example of a Rust object with a layout that can be sent directly to a GPU buffer: https://github.com/paulgb/webgl2-glyph/blob/ef5a64a708856d67...

Re:WASM: Big Deal or Little Deal? by 3cats-in-a-coat on Tuesday September 05, 2023 @10:30AM (#37392192)
I wonder if you have an object whose state has that same schema tied to a DataView offset if it'd be much different tbh.
Re:WASM: Big Deal or Little Deal? by paulgb on Tuesday September 05, 2023 @11:36AM (#37393145)
You could create a JS object with accessor functions that stores an offset, but the object itself still takes up heap space. In Rust, it would just be a (typed) pointer to the position in the buffer and wouldn't require an allocation.
Re:WASM: Big Deal or Little Deal? by 3cats-in-a-coat on Tuesday September 05, 2023 @01:33PM (#37395094)
It's trivial to fix with an ECS layout, but the point is does it matter.
Re:WASM: Big Deal or Little Deal? by robertlagrant on Tuesday September 05, 2023 @04:52AM (#37389373)
> so they are doing something right

That doesn't mean it's a technical thing they're doing right, particularly.

Re:WASM: Big Deal or Little Deal? by paulgb on Tuesday September 05, 2023 @06:00AM (#37389825)
Sure, but it was meant to refute a pretty weak point that basically boiled down to “I don’t like it so it’s bad”. Enough people do like it and find it fast, and while I can match anecdotes, pointing out the success of the company seemed more compelling.
Re:WASM: Big Deal or Little Deal? by o1y32 on Monday September 04, 2023 @11:38PM (#37387576)
People bring up Figma in almost any discussion related to WebAssembly. I tried to dig into this and understand why they chose this, what kind of benefit they are getting from this and how it compares to alternatives. Turns out that there is no comparison in performance because the alternative (doing everything in JS) was never done, and the choice of going WebAssembly is more due to their history and stack than anything else. In other words, if they rewrote the whole thing with in modern JavaScript ecosystem (e.g. TypeScript with strict typing), it is unclear that the product would be any worse than the current implementation, because nobody ever tried that.

Therefore, "Figma is built on WebAssembly so WebAssembly is good" is weak argument.

Re:WASM: Big Deal or Little Deal? by matthewowen on Thursday September 07, 2023 @11:40AM (#37420604)
I work at Figma. Mostly not in that part of the codebase, but close enough to say that it would be worse if we did what you are describing.