Live data from Hacker News

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

tbfleming.github.io

231–240 of 318 posts

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

#232
There is actually an immediate real world use for this (not just being a toy): online judge (like leetcode). Of course, the final evaluation has to be done on the server to avoid cheating on the test set, but the user can do his/her own test in the browser without the roundtrip to and from the server then.

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

#233

Earlier quoted context omitted.

* Now you have signups, instead of installation * Only Linux end users have to care much about dependencies * You're kidding right? * Sure, if you only target one browser your code will probably work more or less the same on that one browser on at least some of the OSs it runs on * There aren't any walled gardens in PC Destkop land worth talking about, other than maybe the package repositories of Linux distributions.

This is a pretty poor response to the parent's arguments... >Now you have signups, instead of installation How are these mutually exclusive? Plenty of desktop software requires a signup first. And plenty of webapps do not require a login. >Only Linux end users have to care much about dependencies It's rare to find a game that doesn't start by installing DirectX, Visual C++ Redistributable, and more. >You're kidding r…

>How are these mutually exclusive? Plenty of desktop software requires a signup first. And plenty of webapps do not require a login.

Some != all, it's definitely -not- the majority.

>Modern browsers have powerful sandboxes and always-active updates to address security threats. Sounding indignant isn't actually making a point.

I have a trusted bloated ball of incomprehensible code running whatever it wants with direct access to memory, video and my entire filesystem. Revoking access to the first set of things is impossible and limiting filesystem access is unlikely to be feasible or actionable for most people.

The Browser is the epitome of complication, people tout security in the browser as if it's infallible yet through complication bugs are more common and prolific. Browsers are not a magic bullet no matter how much there is a wish to "pass the buck".

All you're doing by making browsers more complicated is:

A) Giving more attack surface

B) Increasing complexity to audit.

C) Ensuring the big guys are never challenged.

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

#234
post #38

Earlier quoted context omitted.

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

Out of curiosity, what technologies are you leveraging to write browser-based 3D games? Lightweight WebGL libraries, something higher-level like Unity, or something else entirely?

Rolling my own graphics engine (ugh!) to create a voxel octree platform. Front end uses C++ to Webassembly for the engine core and Typescript for the UX. Backend uses Java with a MSOA. All using a reactive message system.

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

#235

Earlier quoted context omitted.

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…

That is disappointing to hear, I am hoping webassembly will loosen that back up a bit.

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

#237

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 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.

Web browsers cross the uncanny valley home to 99+% of open-source, free-as-in-beer, and even commercially supported cross-platform GUI toolkits. This is due in part to the freedom to evolve new UI/UX concepts, but primarily because incentives align for polishing rough edges.

Web browsers grew up with an always-on Internet connection -- continuously pushing updates to code and data. This has expanded to continuous updates "all the way down" (the native code browser auto-updating on top of an auto-updating OS).

Rebuilding core features such as these, even if by selecting unencumbered open-source libraries, basically means winding up in nearly the same place (since browsers are competing to optimize their implementations). Finding a way to connect to the browser foundation underneath whatever layer in the stack begins feeling bloated is worth evaluating, but there are diminishing returns.

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

#238
post #138

Finally, wasm short-circuited the will of os manufacturers to make their platform exclusive and incompatible with others. Now let's see if wasm performs well enough on Android phones, and I guess we are finally arriving into the software deployment heaven.

So the mobile part is very interesting to me, as i'm no expert on this: as cool as it is, isn't this whole webassembly thing a desktop-only thing? There is no way smartphones will be able to download compile and run this type of code at accettable speed will they?

Or am i wrong?

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

#239
post #126

Earlier quoted context omitted.

It's been proposed a few times[1], the WebRTC crowd just shows up and says that WebRTC is "good enough" and the cycle continues. Never mind that the dependency graph for WebRTC is way too large and that WebRTC is just too complicated for GameDev needs. [1] https://github.com/networkprotocol/netcode.io

I’ve done webrtc “servers” (in C, not some nodejs bindings for the chromium implementation) and webrtc P2P. It really is “good enough” for a lot of things. But not game developers, who are used to dealing with a very forgiving environment that will let them do stupid things quickly. I have watched game developers in earnest busy wait a network thread “for speed reasons” but also derive approximate linear solutions to…

Congrats, you've just gone ahead and proved my point. Zero technical reasons other than an ad hoc attack on game development practices.

Unless you have a client library that can be paired to that server which takes up less than 200kb of mem you won't see adoption. You're going to want to use one network stack across your products and a lot of the handheld and smaller platforms are really memory constrained.

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

#240

Next we'll get to a webassembly-only VM that will replace the OS. All 'apps' will run on this VM instead of being native, and most will be cross platform. They'll talk to each other via messaging (using Javascript semantics) instead of bytes-over-pipes as they do today. An integrated globally available, namespaced data store API might replace the filesystem. Each app+version will be accessible by a distinct URL. 'My…

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

Webassembly doesn't require you to install Oracle software, or lag your computer for 30 seconds while it starts up... And it doesn't require Swing or AWT. So, there are those minor improvements.
Post reply on HN