Live data from Hacker News

WebAssembly: Mozilla Won

robert.ocallahan.org

341–350 of 375 posts

Re: WebAssembly: Mozilla Won

#341
post #330

People seem way too optimistic about web assembly. The elephant in the room is download size. A wasm photoshop, even if it works and performs well, is still a multi-gigabyte "web page". The browser is in no way set up to handle that. Even simple things will be huge compared to javascript webpage. Let's say you write your todo app in Python with Qt bindings. Sure, wasm lets you run it on the web. You'll just have to s…

> The elephant in the room is download size. A wasm photoshop, even if it works and performs well, is still a multi-gigabyte "web page". The browser is in no way set up to handle that. So you split it into chunks and download the bits you need as you go. Microsoft has already figured out how to do this -- you can run Office (the real, full Windows version) basically streaming from the Internet already.

> So you split it into chunks and download the bits you need as you go.

at last, the renaissance of the microcomputer programmers (like the COBOL renaissance of the mainframe programmers)! that kind of technique was common back in the 80s to get things done

http://www.filfre.net/2017/04/the-640-k-barrier/

Re: WebAssembly: Mozilla Won

#342
post #313

People seem way too optimistic about web assembly. The elephant in the room is download size. A wasm photoshop, even if it works and performs well, is still a multi-gigabyte "web page". The browser is in no way set up to handle that. Even simple things will be huge compared to javascript webpage. Let's say you write your todo app in Python with Qt bindings. Sure, wasm lets you run it on the web. You'll just have to s…

Except that the download size for an application of the same complexity in JS and Wasm looks like it will be smaller in Wasm. There are plenty of demo games made in Wasm that play great already. Doing the same thing as those demos requires larger JS and is slower in JS. This just expands on what can be done now. No one is claiming this will fix everything, it will just allow more than we have now and leverage many of…

Exactly. If it's a packaging problem, we'll just need to be smarter about how we package things. Shipping Photoshop as a unified blob of WebAssembly is a dumb idea, just as having the executable load in every single DLL it might ever need is ridiculous. These things are fetched on demand.

Re: WebAssembly: Mozilla Won

#343

It seems there is this effort to get C/C++ code performing fast inside of a browser... then at the same time there seems to be an effort to get people to stop coding in C/C++ altogether and switch to something more memory safe. Go or Rust for example. Also, I watched a talk from DConf and saw that D is adding memory safety as well. You need to mark any part of code doing pointer arithmetic as "system code" or somethi…

> It seems there is this effort to get C/C++ code performing fast inside of a browser... then at the same time there seems to be an effort to get people to stop coding in C/C++ altogether and switch to something more memory safe.

WebAssembly offers a compelling "alternative": instead of (or in addition to, if you desire) writing in memory-safe languages, with all the cost that incurs, you can write in unsafe languages and the consequence of memory errors is limited by the sandbox.

This approaches the problem from a different direction, on one side we have e.g. Go and Rust. Go with garbage collection and its overhead, or Rust with zero-(runtime)-cost abstractions which push the burden onto the programmer at development time. C compiled to WebAssembly is low-overhead but safer than native code, giving the benefits of both worlds.

I would have never expected it, but now believe C is the language of the future for the web. Built on decades of history with an unbeatably large existing codebase, extensive analysis and tooling support, standardization, raw power without the shackles of safety, yet confined to limit damage by the browser sandbox. True cross-platform compatibility with powerful HTML5 web APIs.

My experience about a month so far developing a C application compiled to WebAssembly/asm.js using emscripten has been surprisingly smooth. I can compile and test natively, including enabling the clang static analyzer or -fsanitize=address and -fsanitize=undefined to find bugs endemic to C, fix them and then deploy and run on the web. For the most part I can code directly to OpenGL and GLFW, which emscripten bridges to WebGL and other browser APIs seamlessly. I had to contribute a handful of fixes to emscripten, as well as an implementation of glfwJoystick to the HTML5 Gamepad API (also working on file drop and monitor API), but this was straightforward and easier than expected, emscripten happily accepted the patches. There are Rust (https://github.com/thinkofname/steven) and Go (https://github.com/thinkofname/steven-go) applications in this problem space but porting a similar application written in plain C (https://github.com/fogleman/Craft) to emscripten was nearly trivial (if there is any interest: https://github.com/satoshinm/NetCraft). After about a week I was able to consider the web-based port finished, and then focus on developing new features, for both web and native.

Is C compiled to WebAssembly a panacea? Not by a long shot, there are many (perhaps most) scenarios where memory-safe languages such as Rust would be preferred. But for games and other programs where performance is more critical over correctness and safety, WASM is a godsend.

Re: WebAssembly: Mozilla Won

#344

Earlier quoted context omitted.

Try "g com.scala.List" instead. It's not that much inconvenience.

Does the 'g' prefix do anything? On my Firefox it still searches for 'g com.scala.List' in Duck Duck Go, my default search engine. When I run that on Chrome it searches for 'com.scala.List' on Github because I've chosen g as a search leader for Github (which is super convinient and I wish I could do that on Firefox).

You definitely can do that on Firefox, in search preferences.

Re: WebAssembly: Mozilla Won

#345

People seem way too optimistic about web assembly. The elephant in the room is download size. A wasm photoshop, even if it works and performs well, is still a multi-gigabyte "web page". The browser is in no way set up to handle that. Even simple things will be huge compared to javascript webpage. Let's say you write your todo app in Python with Qt bindings. Sure, wasm lets you run it on the web. You'll just have to s…

[deleted]

Re: WebAssembly: Mozilla Won

#346

People seem way too optimistic about web assembly. The elephant in the room is download size. A wasm photoshop, even if it works and performs well, is still a multi-gigabyte "web page". The browser is in no way set up to handle that. Even simple things will be huge compared to javascript webpage. Let's say you write your todo app in Python with Qt bindings. Sure, wasm lets you run it on the web. You'll just have to s…

A more likely and practical outcome is using the HTML5 DOM UI instead of Qt, and JavaScript instead of Python, etc. Native web technologies the browser already has support for.

There is already a movement towards using the DOM for web game UI instead of canvas, for example this recent article makes some compelling arguments: https://blog.pocketcitygame.com/5-reasons-to-use-dom-instead...

Using web platform technologies can actually reduce the download size over native apps. In the game I am working on, written in C and compiled using emscripten, as a rough measure, the equivalent program compiled natively totals an executable size of about 2 MB, not including texture resource data. An optimized asm.js build is about 950 KB and WebAssembly only 580 KB, this includes the .html shell, .js loader, and .wasm binary itself.

This is not a completely fair comparison because I compile out some native code not relevant to the web, and vice versa, but here are a few specifics of where I believe the gains may come from:

curl: the native C app uses libcurl for fetching resources from HTTP and HTTPS servers, but on the web, we have XMLHttpRequest and HTML5 Fetch. Emscripten provides the built-ins emscripten_wget() and emscripten_async_wget() for these purposes. No need for shipping HTTP and SSL stacks because the browser already has it included.

glfw and glew: libraries for wrangling OpenGL, emscripten has its own implementation which largely simply bridges to WebGL or other HTML5 APIs, a very thin layer. SDL, too.

databases: many apps bundle their own copy of SQLite, often as the single C file amalgamation. I used to, too, even through emscripten and it worked fine (there is even a pre-packaged emscriptenified sqlite.js), admittedly I haven't looked into it much yet but the web platform supports IndexedDB built-in, no extra dependency needed.

JSON: how many JSON encoders/decoders are there out there, separate copies in all of the apps? On the web, you can rely on JSON.stringify and JSON.parse (from JavaScript, but all functionality is bridged through WebAssembly anyways).

We may see a resurgence in "small C libraries" targeting WebAssembly. There is a growing trend of header-only libraries, especially the popular stb: https://github.com/nothings/stb#stb_libs and there is a growing list here: https://github.com/nothings/single_file_libs I consult to find tiny libraries appropriate for linking into a web-based C application. lodepng (for decoding PNG images) and miniz (for reading and extracting zip files) are about the only substantial dependencies I have beyond what is in the emscripten standard library. Everything else is provided by the browser, the web has grown to a surprisingly powerful and complete platform.

Re: WebAssembly: Mozilla Won

#347
post #330

People seem way too optimistic about web assembly. The elephant in the room is download size. A wasm photoshop, even if it works and performs well, is still a multi-gigabyte "web page". The browser is in no way set up to handle that. Even simple things will be huge compared to javascript webpage. Let's say you write your todo app in Python with Qt bindings. Sure, wasm lets you run it on the web. You'll just have to s…

> The elephant in the room is download size. A wasm photoshop, even if it works and performs well, is still a multi-gigabyte "web page". The browser is in no way set up to handle that. So you split it into chunks and download the bits you need as you go. Microsoft has already figured out how to do this -- you can run Office (the real, full Windows version) basically streaming from the Internet already.

That's funny - I stopped using Microsoft Office because of that very thing. I have Office '07 still for some minor graphical compatibility reasons, but generally speaking I use the bundled, free, offline, WordPad/NotePad, LibreOffice, and/or AbiWord.

Re: WebAssembly: Mozilla Won

#348
post #316

Earlier quoted context omitted.

As pointed out, this will be HUGE. For starters, this will enable client (browser) software development in a language other than Javascript/ES6. With, probably, a plethora of compilers to choose from, some of them giving better optiimizations than others. I think this will make an explosion of more browser-hosted applications, with much more power than before. And will make many more programmers go into serious front…

Sounds like a huge web page.

I mean... Theoretically you could make a big fuck off web app right now in JS, it's not like WASM == huge apps. It sounds to me like the back end coders will coming forward to the browser where before you had the front end moving toward the back with things like Node.

Re: WebAssembly: Mozilla Won

#349
post #308

Earlier quoted context omitted.

It does a DNS lookup and if it's a valid domain shows you this. If you see it for complete nonsense, then it's possible your ISP is doing DNS Hijacking like mine! Eg. if I type "cheese", it shows "Did you mean to go to http://cheese/" ? If I click that link I get TalkTalk's "Error Replacement Service" full of ads (or at least I did, till I switched to Google DNS because TalkTalk's "opt-out" system has been convenient…

Ah, that explains that. I always found that feature annoying, I didn't know it was because my ISP misbehaving. I always get a century link search page when I typo urls.

Yeah, that'll be it. There's some info on all the stuff it breaks here:

https://en.wikipedia.org/wiki/DNS_hijacking

The new Google "did you mean to go to ?" nonsense is something else to add to that link!

My ISP (TalkTalk) claims to have an opt-out page but the forums suggest it's been broken for years, and today it is a 404. I have an open issue with the CEOs office to opt me out manually but they've been pretty useless so far.

Re: WebAssembly: Mozilla Won

#350
post #290
post #231

Earlier quoted context omitted.

The partial intent of WASM is to write things orders of magnitude larger than jQuery. Whether or not it will ever be practical to ship e.g. a complete Photoshop clone in a browser remains to be seen, but if that's your goal then you do have to start worrying about things like parse time.

Why would the whole Photoshop be downloaded and compiled? I would expect a web app to only download the parts the I use. If I want to blur an image, I don't need the other gazillion filters for example. And hey, even if photoshop is 1000 times bigger then jquery - that would still compile in one tenth of a second.

Developers like you are why apps are slow when they don't need to be.

EDIT: Also, if you think 10%-20% smaller downloads aren't worth it, you're clearly not working at a CDN.

Post reply on HN