Hacker News new | ask | show | jobs
by brrt 3856 days ago
Hi. That blog post refers to parrot vm threads, which is not what the current MoarVM or JVM implementations use. Both these VMs support 'real' OS level threads without any global locking (beyond what is needed for GC). In case of MoarVM, that support is built on libuv. And there is a very interesting high-level interface built on these fundamentals.
1 comments

Libuv is what node.js is built on, and I've seen some benchmarks of really impressive performance w/r/t MoarVM.[1]. https://github.com/perl6/mu/blob/master/examples/concurrency... Here is how "real" (i.e., not fake, spawn processing) concurrency is done in Perl 6.

Rakudo's had more testing since it's been around forever but MoarVM is where my hopes lie. Here's hoping user adoption isn't fractured that badly like D's Tango vs Phobos debacle (which only now it's recovering from, I'd argue largely due to Andrei Alexandrescu's charismatic persona, haha.) Perl 6 is a really interesting language and I'd encourage you all to play with it, but it's an entirely different beast than Perl 5. They should have just renamed it entirely.

[1] http://www.moarvm.org/features.html

"Rakudo's had more testing since it's been around forever but MoarVM is where my hopes lie" is a little confusing to me. Rakudo and MoarVM are not the same type of thing. Rakudo is a Perl 6 compiler with multiple backends. I don't follow this very carefully, but I think it used to have a Parrot backend, and currently has two maintained backends: one for the JVM and one for MoarVM.

Is that wrong? If not, did you mean "Rakudo on Parrot" or "Rakudo on the JVM" when you wrote just "Rakudo"?

Rakudo is an implementation of Perl 6 built on top of NQP (Not-Quite-Perl. a pseudo lang that implements the easier parts of Perl 6 that can be targeted and optimized by VMs), and MoarVM is a C-based NQP interpreter. There is also an NQP back-end for the JVM, which is now Rakudo runs on the JVM. Think of NQP as an intermediate language (kind of like java bytecode but much higher level).

It's like this: Rakudo -> NQP -> MoarVM

or like this: Rakudo -> NQP -> NQP-JVM implementation -> JVM

Want to get Perl 6 running on the .Net CLR? Implement an NQP interpreter (which is supposed to be fairly easy) and you're 99% done (at least that's my understanding).

Strictly speaking, MoarVM is not an NQP interpreter - it runs MoarVM bytecode.

Sure, MoarVM is by design semantically close to NQP, but if you look at

    $ nqp-m --stagestats -e ''
    Stage start      :   0.000
    Stage parse      :   0.003
    Stage ast        :   0.000
    Stage optimize   :   0.000
    Stage mast       :   0.005
    Stage mbc        :   0.000
    Stage moar       :   0.000
you get mostly the same steps as on the JVM

    $ nqp-j --stagestats -e ''
    Stage start      :   0.000
    Stage classname  :   0.045
    Stage parse      :   0.067
    Stage ast        :   0.000
    Stage optimize   :   0.009
    Stage jast       :   0.145
    Stage classfile  :   0.010
    Stage jar        :   0.000
    Stage jvm        :   0.003
except that MoarVM bytecode files do not get bundled into JARs and there's no need to do the extra processing that happens in the 'classname' stage.
Fair enough. MoarVM is just another interpreter targeted, but it just happens to have been designed with NQP and Perl 6 in mind, so it maps extremely well.