Hacker News new | ask | show | jobs
by mraleph 4370 days ago
Here is a question to consider: can the web where you can't efficiently[1] implement any dynamic language with a semantics different from JavaScript be called truly open?

[1] I am well aware about different attempts to attack this issue from various angles from AOT to JIT generating JS code but no attempt currently produces truly efficient solution that demonstrates small footprint and consistent high performance on par with native VM across all of the web or even across its relatively modern part.

1 comments

First, you're using "open" in a way I haven't heard before (not in the context of "open web"). Not saying it's wrong :) Perhaps we should use it that way too. But you're suggesting a new perspective here. We could debate that first, before debating the technical stuff. Or perhaps we could call it "technologically open."

But to focus on the more interesting technical stuff: First, we have a fast Lua VM port. Not LuaJIT, but even the Lua VM itself is quite fast for a dynamic language (and the port is 2/3 of native speed).

Second, there are experiments with JITs targeting JS, like pypy.js. Yes, pypy.js has a large footprint, as you referred to. But I think the fact is that very little effort has gone into this. Much more is possible than has already been done.

If we had a large, serious project doing this, I think we could see the potential. Instead, things like pypy.js are spare-time projects of a single person. So it's not fair to assume that their success or failure in terms of performance and footprint is indicative.

It's my understanding that Shumway is basically a full-scale AS2/AS3 VM & JIT using JS as the codegen target, is that wrong?

JSIL is increasingly a JIT that targets JS instead of an offline JS compiler, if only because JS runtimes are so terrible at optimizing C# code and semantics. Eventually it may end up being like Dalvik, where the offline compiler runs a filtering/transform pass on the input bytecode and all the actual codegen happens on the client.

Hard to be sure, as you pointed out it's hard to do serious CS research like this as one person in your spare time :-)

Thanks! I forgot Shumway. Last I heard it was competitive with the Flash runtime (better on some stuff, worse on others), so that seems like a clear counterexample to mraleph's concern.
Isn't Shumway more of a confirmation for my concern than a counter example? Shumway is running ActionScript which is extremely close to JavaScript semantically though somewhat more strict and allows for optional typing.
It agrees on numeric types, but it has very large differences like namespaces, classes, etc. Look at how complex the Shumway VM is.
AS3 also has things like pointers (via domain memory). The closest thing to that in current JS is asm.js.