News for hackers. Stuff that matters.
Re:Up to 4GB of Memory in WebAssembly by gpm on Thursday May 14, 2020 @05:31PM (#23185777)
The overwhelming majority of what wasm will be used for probably does not include images, textures, sounds, videos or 3d models. The overwhelming majority of the memory in most wasm programs will probably be not large arrays of text.

The webpage as a whole is a gui program, but wasm is primarily a place to run computationally intensive code. The web-browser deals with things like rendering images natively without storing the image in wasm.

Re:Up to 4GB of Memory in WebAssembly by monocasa on Thursday May 14, 2020 @05:38PM (#23185849)
What do you think that computationally expensive code is cranking on? It ain't small bits of text.
Re:Up to 4GB of Memory in WebAssembly by gpm on Thursday May 14, 2020 @08:58PM (#23187666)
When it is text, it's usually more small bits of text than big bits. If you're just copying around giant strings you're unlikely to be using webasm. More likely you're copying around tons of small strings as you format them into a giant string if that's the end goal. Or you're copying around tons of small strings as you use those small strings to make api calls to the dom (indirectly through js). Or you're just plain running something like a physics simulation and don't even have text in the first place.
Re:Up to 4GB of Memory in WebAssembly by xscott on Thursday May 14, 2020 @07:03PM (#23186679)
Honestly, I don't like the trend of web apps for everything, and I'd be ok if web pages couldn't really be more than toy programs. However, at that point, why even bother with WASM? I mean what is that even for if you're not doing real computation on real data sets? Real data sets are bigger than 2 billion sometimes...
Re:Up to 4GB of Memory in WebAssembly by gpm on Thursday May 14, 2020 @09:02PM (#23187680)
If you've got 2GB of data and you're doing it in WASM... you're probably doing something wrong, for the simple reason that that means you probably loaded 2GB of data over the internet into the browser (and will probably need to redo that every time you revisit the page). That's enough data that you want to save it to disk, which means (probably) not using a browser.

As for "what is the point if not doing computation on "real" data sets"... letting you do computation on reasonably sized data sets. Consider that the size of a gaint codebase like linux is still only a few hundred megabytes (uncompressed). That's more than enough data to be doing interesting work. Or look at the size of a game like quake3.

Re:Up to 4GB of Memory in WebAssembly by xscott on Thursday May 14, 2020 @09:54PM (#23187994)
> for the simple reason that that means you probably loaded 2GB of data over the internet

No, web pages can access local storage.

Re:Up to 4GB of Memory in WebAssembly by gpm on Thursday May 14, 2020 @09:59PM (#23188037)
You mean file:// urls? If you have access to do that... why not just install a real executable as well.

(Can't say I'm terribly up to date on the different ways to store data as a website... but if there's a way to persist multiple gb I would be very surprised)

Re:Up to 4GB of Memory in WebAssembly by xscott on Friday May 15, 2020 @02:58AM (#23189673)
I really don't like being in the position of defending web apps - that is really not my preferred way to do most things I would write. However, taking a devil's advocate position:

> You mean file:// urls? If you have access to do that...

Modern browsers provide JavaScript with way more power than just file urls: https://www.w3.org/TR/FileAPI/

There are also drag and drop APIs...

> why not just install a real executable as well.

That depends on who your audience is. It's certainly easier to tell some users "go hit this web page and click ok when it asks to open your file". And there are some web apps which I find preferable to downloaded apps. For instance, I really like draw.io, and it works seamlessly on Windows, MacOS, and Linux.

> but if there's a way to persist multiple gb I would be very surprised

The only limitations I'm aware of are tied to this nonsense about 32 bit integers :-)