42 points · by pron · 13y ago · 51 comments
It's a bit like those benchmarks that show that a language that's a subset of Ruby, performs much faster than actual Ruby. Well, yes, that's nice--but we use Ruby precisely for all the inherently-really-slow parts. Once you add all the slow stuff, and have to check whether to branch to it at every call, your speed advantage stops being nearly so impressive.
Erlang is a painful language to code in; you don't do it because it's pretty. You do it for what the BEAM VM and the OTP libraries give you: the ability to spawn 100k processes representing, say, people's phone calls, or their MMO game sessions, and not drop any connections for something piffling like a garbage collection pass, or a bugfix. I would expect no less of any "universal" VM. (Though I might, of course, expect more. It should probably be able to do CPU-bound stuff like large matrix multiplications without dragging the rest of the VM down, for example.)
The JVM does support hot code loading. In statically typed languages like Java it's not so easy to use, but there's no reason not to use it for Erlang.
> and it definitely doesn't work in a soft-realtime manner
You're misinterpreting. While the JVM, unlike Beam, has a single heap (which brings significant performance advantages over Erlang's copying), its GC is so much more advanced than Beam's, that in spite of this limitation there's no reason it shouldn't behave as well as, or better, than Beam.
Also, this is a solved problem. If you want to absolutely guarantee no pauses at all, use a commercial JVM that guarantees that.
> you're just running a pretty-useless-for-its-intended-purpose subset of the language.
This is a huge exaggeration. Beam has its issues as well, and if you can deliver better performance overall a lot of people would gladly take it in exchange for the occasional pause (or pay money to eliminate the pause).
> Erlang is a painful language to code in; you don't do it because it's pretty. You do it for what the BEAM VM and the OTP libraries give you: the ability to spawn 100k processes representing, say, people's phone calls, or their MMO game sessions, and not drop any connections for something piffling like a garbage collection pass, or a bugfix. I would expect no less of any "universal" VM. (Though I might, of course, expect more. It should probably be able to do CPU-bound stuff like large matrix multiplications without dragging the rest of the VM down, for example.)
The JVM can deliver all that, with awesome performance to boot.
I have the utmost respect for Beam, but the JVM can give Erlang a different set of tradeoffs that is very attractive in many circumstances (I would argue in most). No one can take Erlang's valuable concepts away from it. That doesn't mean running it on a different VM implementation is not beneficial for both Erlang and JVM communities.
I think this is unfair to my work. It's true that it is an incomplete implementation of Ruby, but to a greater or lesser extent so are Topaz and JRuby. Charles Nutter independently identified the tricky parts of Ruby that you are talking about, and said that people should implement these before speaking about performance numbers. We went through that list and implemented all of them to at least the same standard as JRuby, with the exception of C extensions, we have a GIL and we can't yet run Ruby on Rails.
So for example you can redefine Fixnum#+, or do any other crazy monkey patching, and we will run at exactly the same speed. This is actually unlike JRuby, which has a special fastpath for call sites calling these methods that if you monkey patch will be turned off.
This is all covered if you watch the full video. If that's still unclear, please join us on the Graal mailing list and we can chat. http://openjdk.java.net/projects/graal/
Most sequential programs that rely on native threads, whether in C or Java or whatever, just use 5-10 "big" threads, where each thread is still multiplexing work on its own large corral of data. In a game, for example, you'll see one "graphics thread", one "network thread", one "AI thread", etc. Not "one graphics thread per voxel"; not "one network thread per peer connection"; not "one AI thread per NPC". These designs are bad, in a traditional sequentially-oriented VM, precisely because they will blow up on you in the worst case (e.g. when you look to the horizon on a Minecraft server.)
Are you saying LLVM can't be used to efficiently implement Erlang-style processes/tasks? I thought Rust was aiming to be able to handle a large number of lightweight tasks, and its based on LLVM?
Rust is a lot more like Go, with its multitasking primitives being based on channels (shared-memory atomic data structures) rather than message-passing-by-copying, and each actor/thread of execution allowing mutable state within itself, as long as its mutations don't leak across actor boundaries. In other words, it doesn't really change the semantics overmuch from that of the non-NUMA multicore Von Neumann machine (e.g. x86) it's running on; it just does "green threads" the traditional way, with some elegant builtins for getting data from one to another. Rust's and Go's semantics are both isomorphic to x86/LLVM/JVM/CLR semantics, as far as I can tell; you can translate directly from one to the other without any overhead from maintaining an implicit VM state machine (in est, a monad) across the compiled code chunks.
And of course I want it for free. Once all the goodness for JRuby, Rubinius and that Oracle stuff get shaken for a long enough time, I guess we should see the benefits in our everyday-coding.
However it's hard to deny that there's a very large stigma attached to the name "Oracle."
http://www.modernperlbooks.com/mt/2013/02/goodnight-parrot.h...
It seems they have been building their own CLR.
This work has been discussed for possible integration into the standard JDK in a post Java 8 version, as part of project Graal.
It's quite different to the CLR. The CLR lets you implement any language you like, as long as it can basically be mapped to C# constructs, not that different from the JVM.
What Snoracle is working on is more generic with much higher performance.
C# isn't special and doesn't represent the CLR's potential. It certainly might drive the evolution of the CLR to a point.
http://jaxenter.com/java-ee-7-officially-launches-bringing-h... http://docs.oracle.com/javaee/7/tutorial/doc/jsf-facelets009...
My bet is that their website must be accessible to the corporate desktops of companies that buy Oracle stuff. That means it has to work with IE6, most likely.