Live data from Hacker News

Clang runs in the browser and compiles C++ to WebAssembly

tbfleming.github.io

151–160 of 318 posts

Re: Clang runs in the browser and compiles C++ to WebAssembly

#151
post #41

So the web browser is pretty much a mini operating system. Firefox and Chromium seriously feel like they have the longest compile time out of any package in Gentoo, except maybe Libreoffice. It has tons of embedded packages that it doesn't pull from the system/native (jpeg and png decoders and such). So with a lot of these neat things where we compile stuff or run a Linux kernel in the browser, we've pretty much come…

I have been thinking about why we have ended up here, and why not just native apps. The obvious answer is that it makes applications portable, which is great. The other key component I think is delivery. You don't ever install anything, it just exists when you ask for it. That is something native applications have never done, and not even something like JVM has done even though it addresses portability too. It is als…

> are there lessons from browsers that we can integrate into the OS?

Windows 10 is working on adding tab navigation to all windows: https://arstechnica.com/gadgets/2017/11/tabs-come-to-every-w...

Re: Clang runs in the browser and compiles C++ to WebAssembly

#152
post #80

Earlier quoted context omitted.

Unity also has the slight delivery hitch of needing the browser plugin to run games in the browser. I tinker with Unity and I still didn't install the browser plugin. That is the same hitch the JVM had. For a non-technical user, that extra step feels risky and unintuitive. "Why doesn't it just work?" feels a bit unfair when you know what's going on, but to a normal user I think it's a fair question. We are the profes…

Yes. Please, someone, make gamedev in the browser a reality. There are a thousand hitches: Why can't I install a 9GB game on the browser? We need all that space for textures. "But what if –" Oh come on, we can figure it out. There must be some way. Also UDP. Yeah, we have WebRTC, but look up Beej's guide to network programming. That's the threshold of intelligence required. Currently to get WebRTC working with UDP fo…

I'd rather not see (offline) games in the browser, or any other online-based method, personally. I want to have control over the games' data files so i can copy them to my external hard disk, be able to run them in 10 years without hoping some server is still online and their owner gives a damn about stuff they made 10 years ago (most stop giving said damn within a couple of years, let alone 10), etc.

Let's not forget that the cloud is really someone else's computer and relying on said cloud means relying on someone else for your stuff.

And let's learn a little about all the thousands of Flash games that are in the process of being lost forever with the their hosting sites now shutting down.

Re: Clang runs in the browser and compiles C++ to WebAssembly

#153
post #41

Earlier quoted context omitted.

I have been thinking about why we have ended up here, and why not just native apps. The obvious answer is that it makes applications portable, which is great. The other key component I think is delivery. You don't ever install anything, it just exists when you ask for it. That is something native applications have never done, and not even something like JVM has done even though it addresses portability too. It is als…

It also makes it hard to pirate your software. Cracking native software is relatively trivial which is why legitimate licenses cost insane amounts. Contrast soundtrap charging $15 a month for their web based DAW to Ableton having to charge $750 to make up for piracy costs.

On the flip side of that coin, as a user, it also makes hard to control your own software - you are not in control of the version you are using, not in control of the features the program has and above all not in control of the availability of that program as whoever owns the server you are accessing it from can revoke that access at any point for whatever arbitrary (but of course always mentioned in the Terms and Conditions that nobody reads) reasons.

I'd be aware of promoting anything that takes control away from the user. The web is fine for sharing knowledge and communication (and pictures of cats) but let's not put everything in it or we'll certainly regret for giving away the power to control our software.

Re: Clang runs in the browser and compiles C++ to WebAssembly

#154
post #17

This is really slick. Clang took about 20 secs to load on my quad core MBPro. How does this change web development ? Do we need an Ecmascript equivalent for C++ ?

>Ecmascript equivalent for C++ W-what?

Sorry, for sounding this stupid. Does this imply you can now do web programming with C++ instead of Javascript.

Re: Clang runs in the browser and compiles C++ to WebAssembly

#155
post #117

Earlier quoted context omitted.

Can you point me to them? Thinking about using HTML to build an app with good UX lets magic smoke leave my head.

Qt should work.

only QtQuick thiugh, Qt Widgets aren't really optimized for GL

Re: Clang runs in the browser and compiles C++ to WebAssembly

#156

People might not like it but i really think native apps are going to die once everyone figures out how to optimize this crazy web stack.

I don't think so, not when my native game needs 50GB of install space. There is no way I'm waiting for that progress bar to download in a webassembly version game. This is one area where native will always have an advantage. The network is no match for the local bus.

Re: Clang runs in the browser and compiles C++ to WebAssembly

#157
post #30

Earlier quoted context omitted.

Main issue is memory usage. Running KDE+Kate - http://vps2.etotheipiplusone.com:30176/redmine/emscripten-qt... - uses 1793MB (htop VIRT), 416MB (Chrome task manager). (Oh, and the renderer process wasn't hosting any other tabs.) Second main issue is speed. qsterix isn't as memory-heavy but runs all Tetris game code inside KDE JavascriptCore, which as part of the KDE/Emscripten build is transpiled to JS. In other word…

I can't wait to package this up into a beautiful Electron app.

the whole of qt and kde compiled to javascript and ran as an electron app... i can't even

Re: Clang runs in the browser and compiles C++ to WebAssembly

#158
post #9

Earlier quoted context omitted.

How many threads do you think the browsers will allow on a single page?

As many as is needed. And as many processors as are needed. As someone who writes browser based 3D games, I need more power!

I don't think it'll go that way, i remember when web workers first came out i wrote a simple raytracer with some GI and optionally used web workers if available for multiple threads. It worked fine until some browser updates later that limited the amount of web workers pages could use (or the amount of time each worker got, i don't remember, it has been a few years) making the web worker version have pretty much the same speed as the regular version.

Re: Clang runs in the browser and compiles C++ to WebAssembly

#159

Earlier quoted context omitted.

Replace “WebAssembly VM” with “JVM” and you will see how it’s already available, and why it won’t catch on.

JVM had to be installed, and it was far from seamless the way OP describes it. The advantage of wasm is that all the people running Chrome today already have it.

Plus the java installer would sneak in some junkware/toolbars in the process

Re: Clang runs in the browser and compiles C++ to WebAssembly

#160
post #35

Earlier quoted context omitted.

It's definitely possible but we went through all of this a decade ago with Adobe Air, Microsoft Silverlight, and JavaFX. Nearly a decade before that, in the early 2000s, we went through this with Macromedia Flash, Java Applets, and Microsoft ActiveX. Trying to replace native applications with runs-in-the-browser RIAs is nothing new, but we're at least finally agreeing on the language/implementation, so maybe this tim…

> Trying to replace native applications with runs-in-the-browser RIAs is nothing new There is one thing that is new: the users do not need to install a separate piece of software, and it's kept up to date by the browser vendor - which means for enterprise users one less piece of software to certify/test for updates/compatibility, and for private users one software less which installed adware on each update (Java IIRC…

Flash Player had something like 97% penetration, so for all intents and purposes it was something that you could always consider as being "there" - and users didn't mind having to install it.

I think a lot of techies underestimate people's willingness to install stuff on their PCs, especially when that stuff is needed to do tasks they really want and are a couple of clicks away.

Post reply on HN