
Emscripten (LLVM-to-JavaScript compiler) 1.0 - carussell
http://syntensity.blogspot.com/2011/04/emscripten-10.html
======
Smerity
Emscripten, given the recent advancements in Javascript interpreters, holds
immense promise. There is a problem however: the size of the Javascript
"executables".

As the size of their executables are already competitive with their C/C++
counterparts this is not easily fixed. CPython's "Javscript" runtime is 2.8
megabytes whilst CPython's C runtime is 2.2 megabytes, less than a 30%
increase. With compression the JS size decreases, but not by enough.

A 2 megabyte JS file is likely prohibitively large. Even if common JS
"executables" were hosted by Google, as is currently done for jQuery and other
libraries, the problem is only mildly alleviated.

Emscripten is an amazing technical feat but I fear due to this it will see
little usage. Their main focus currently is improving performance, but is
anyone looking into decreasing the size or improving the handling of these
"executables"?

~~~
tlrobinson
_"A 2 megabyte JS file is likely prohibitively large."_

Tell that to Gmail. They load at least 2MB of code. New Twitter loads 1MB.
Facebook used to load that much, but it appears they've cut it down a lot
recently.

It's certainly prohibitive for webpages and lightweight page-oriented web
applications, but not single-page web apps. I would expect this to be used
more for the latter.

------
jimmyjazz14
In my opinion this is probably the most exciting thing being done with
Javascript currently; I can't wait to see where this goes.

------
snotrockets
Quote Brendan Eich (if I'm not mistaken): “JavaScript is x86 for the web”

------
nitrogen
This looks very useful for now, but shouldn't we be trying to get LLVM-based
native client standardized for the long term?

~~~
lautis
If we wanted to have LLVM-based native clients, Emscripten would definitely be
needed.

Distributing binaries isn't feasible as they aren't portable. Chrome would
like to address this by distributing LLVM bitcode[1] and then compile this to
native binary using LLVM. Portable Native Clients were introduced as an idea
one year ago, but AFAIK there hasn't been much development, mostly because
LLVM itself isn't very portable.

If native clients would be the path for future web apps, we can't reasonably
expect the whole world to switch to LLVM in one night. There would have to be
some fallback. As both Portable Native Clients and Emscripten work on LLVM
bitcode, Emscripten would be the natural choice.

[1] LLVM's name for their intermediate language, low-level bytecode

~~~
ieefransi
How are they not portable when translated to javascript ? Granted, this will
probably never run Quake in the browser, but if you want a SHA256 hash
translated to javascript ... I seriously doubt there's a better tool.

All the difficult C stuff instantly useable from javascript, from GWT, from
...

That's got to be a boon, right ?

------
mckoss
Amazing. Tried to run the current CPython port on iPad and the browser
crashes. :-(

------
thasmin
Can someone give an example of what this would be used for?

~~~
irfn
imagine a hugely useful c library being compiled into javascript for use in a
browser env and even nodejs.

~~~
skrebbel
on the latter example: you could also just compile that hugely useful c
library as a nodejs plugin directly.

