Previous Entry Add to Memories Share Next Entry
The web just got a thousand times more exciting.
Illuminati
andrewducker
A few days ago Mozilla announced that the Nightly version of Firefox now supports asm.js.

asm.js is a very small part of javascript that can be incredibly highly optimised (if your browser supports it), so that it runs much, much faster than normal Javascript.

How much faster? About half the speed of C.


Now, nobody in their right mind is going to _write_ in asm.js. It's not very human readable, or writeable. You write your code in other languages and then it compiles to asm.js. Which means that you can write in anything which has a compiler that produces it (so far, just emscripten, which converts LLVM output), and get something which runs inside a browser, with no plugins. So far, only Firefox supports this level of optimisation, but I'm hopeful that Chrome will join it. And even if it doesn't, the code will _still run_ in Chrome. It just won't be as blindingly fast.

What makes this particularly exciting is that today Mozilla announced that, over the last four days, Epic ported the Unreal Engine to asm.js. Four days, to port over an amazing 3d engine, and have this running in your web page:


And, one assumes, they're still optimising. I doubt they'll ever make it quite as fast as C. But I'm sure they can get faster.

And then we have a standard way of getting real applications running on any computer that can run a browser, no matter what operating system it's running on. This really does feel like a step change to me.



Original post on Dreamwidth - there are comment count unavailable comments there.

When I saw 'as fast as C' I thought you meant the speed of light. :)


Half(ish) the speed of compiled C is something I can live with :->

I'm glad it wasn't just me who thought that!

Also, I've just remembered that the speed of light isn't C, it's c!

You make me mournfully nostalgic for the Tao Group's Taos (later intent from Elate, and also known as AmigaDE for a while). All this mucking around compiling binaries for native processors is so 1970s, man.

http://www.osnews.com/story/157/Tao_Group_on_ElateOS_AmigaDE_and_More

http://www.uruk.org/emu/Taos.html

Up to a point. My brother is writing code for the iPhone at the moment, and had to abandon ObjectiveC to drop down to C and be able to twiddle bits directly, for speed.

But for most people's purposes, that's just not necessary.

"...abandon ObjectiveC to drop down to C and be able to twiddle bits directly, for speed."

I can't actually make sense of that. Almost everything that's valid in C is valid in Objective-C. The only real difference is that Objective-C has dynamically bound method calls that can be a bit slow, but avoiding method calls isn't really 'dropping down to C'.

Do you have an example of what he means?

I'm fairly sure that most of the graphical/intensive stuff is written in C++, precisely because of the slow message passing overheads. He mentions it in passing here:
http://mikeducker.wordpress.com/2012/12/12/technology-choices/
and links to:
http://it.toolbox.com/blogs/macsploitation/bypassing-objectivecs-message-passing-mechanism-for-speed-24946

I got very excited about Tao in the 90s as Acorn and TAo were dancing around each other to make TaOS a replacement for RISC OS. Didn't pan out of course. But I loved the ideas and the architecture.

Well, quite.

I actually managed to play with a running system for a very short time, on an early-model Acorn RISC PC at an Acorn show in about 1996. It was a very odd GUI, but then, it was a very odd OS.

But, like many older OSs, so much more exciting than the pedestrian C21 OSs, with squillions of bytes of RAM and so many FOSS libraries for this, that and the other that one can just import antigravity and be up up and away, but which are all variants on Unix with just one exception.

(Which is Windows.)

Bring back Taos and BeOS and AmigaOS and SMSQ/E, bring back native Smalltalk and Lisp OSs. Let's have some variety. It's a damned sight easier than cloning extinct animals from fragmentary, degraded DNA -- particularly when living species are being extirpated at more than one a minute or something as it is.

Edited at 2013-03-27 11:56 pm (UTC)

Yes, I had much the same reaction. This news has galvanised me into actually sitting down and trying to write an Emscripten-based Javascriptification of my puzzle collection, to replace the existing Java-based webification (which is more or less an embarrassment given that Java now seems to have turned into 'that thing which is auto-disabled by Firefox 3/4 of the time due to the latest unpatched exploit').

I don't imagine that'll be nearly the most CPU-heavy thing people will be doing with asm.js, but it's one more project that's been unblocked by making the whole browser/JS platform look basically realistic for serious computation.

You are viewing andrewducker