Live data from Hacker News

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

tbfleming.github.io

51–60 of 318 posts

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

#51
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…

   The other key component I think is delivery. You don't ever install anything, it just exists when you ask for it.
That is precisely why I made the jump from Delphi to ASP.NET back in 2003, and now the jump to Angular2+.

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

#52
post #35

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.

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 still does) and has that "risky" association like Flash does.

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

#53

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…

Just need to be able to run Chrome/Firefox directly in a Docker instance, and we’d be there.

But seriously, maybe that’s the next step in this crazy ride we’re all on.

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

#54
post #18

Earlier quoted context omitted.

Native apps are often written in web technologies via Electron. It all depends on what you need and what access you can get. Plus, someone has to maintain the browser and its packages, so there will always be need for systems developers.

An Electron app is not considered a native app

Not on Hacker News perhaps, but certainly by the rest of the world.

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

#55

Earlier quoted context omitted.

I disagree. When people start using native languages like C++ for the Web, they will quickly realize they could have just used C++ to begin with.

I haven't looked much into WebAssembly, but regardless of the native language that you use, your app will be cross-platform without having to put any extra effort, won't it? This solves one of the biggest pain points of native GUI development. While it's pretty amazing what QT has managed to accomplish, I still hear incompatibility problems between OSs.

It "solves" it by not solving it - WebAssembly doesn't do UIs, that component is still built in HTML. The wasm functions are just doing the expensive computation. I think there's been some work to build DOM apis in languages that compile to wasm, but for the most part the workflow is to create your UI in markup or standard javascript and then call out to wasm functions to do things, or else building the UI in WebGL (e.g. games)

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

#56
post #51
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…

The other key component I think is delivery. You don't ever install anything, it just exists when you ask for it. That is precisely why I made the jump from Delphi to ASP.NET back in 2003, and now the jump to Angular2+.

Why Angular instead of React...or something else like Vue?

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

#57
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…

Most users spend >80% of their time in the browser. It's probably that simple. If you have a thing and you need users, are you really going to deliver it as a Qt app? Unless you're bitcoin, it's hard to think of a case. I'd say "or a game," but many are webapps. And at this point some of the hollywood-grade games might figure out a way to be coming to browsers soon. Unreal did it.

It is that simple. And a bummer because I think HTML is a pain for things that aren't documents. And JS UI frameworks feel like hacks too.

Unity already supports the web, but I don't think that'll matter for AAA games. People who buy computers specifically to play them will care about the slight performance hit and not want to keep the games they bought and spend a lot of time with as bookmarks to web pages. Non-performance intensive tools, even large ones, have already moved to the web. This will likely continue because there is not other platform delivering its level of portability and ease of delivery.

It's a bummer because the web just kind of sucks. It was made for documents, damn it. Something like a java browser could've succeeded as jars are already very portable. This could've worked pretty well for small and large tools alike. But since the HTML stack is already widely adopted I guess we'll have to make the pain go away somehow. At least webassembly solves the problem computationally intensive tasks. The UI component is still quite a mess, but that's getting better too. I just find it annoying that they have to call everything Web-(what it traditionally was). It's basically the new reality, being used on non-web platforms as well as on the web.

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

#58
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's definitely far behind where web apps are for instant no-install access, but Android has their "Instant Apps" feature providing similar capability https://techcrunch.com/2017/10/19/google-play-adds-android-i... Disclaimer: I don't have an android phone anymore and I have no idea how available/useful these actually are

Extremely far behind schedule, but for the apps it does work for it's not even that bad. The android app architecture seems to require some heavy restructuring to do this though, so I don't think it will be attractive for developers. The portability problem of course holds this back from the insane adoption the web has gotten as well. Basically it's too little, way too late.

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

#59

Earlier quoted context omitted.

An Electron app is not considered a native app

Sure, but they compete with native apps is the point the parent was making. They download, install, update, configure, and use features like a native app.

But they often don't perform like native apps, both when it comes to size, speed, and look and feel.

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

#60
post #31
post #24

enlarged memory arrays from 536870912 to 1073741824, took 28094 ms

That's a bit excessive. I got the same with "57 ms", and quite a lot of my 8GB RAM (and several GB of swap) are used.

17ms and 533MiB. Seems like quite a lot of variability. This was Chrome on Mac OS.
Post reply on HN