Defeatism

September 13, 2011

Perl 6 OTOH is so flexible that the structure of the objects is determined by the meta object protocol, and can be changed at will. Likewise are other parts of the language sufficiently flexible that you can’t build a JIT compiler which special-cases all the common Perl 6 idioms, and thus becomes fast.

In other words: the VM we use is technologically 10-15 yrs. behind the state of art, and our new programming language is plastered with lots of features that make it resistant against all optimizations.

Yeah, I’m mean and surely it wasn’t meant that way.

Crank up the shaft

December 10, 2010

There is an arms race in the dynamic language communities for the fastest interpreter/compiler. Especially the Javascript engines are examples of that. Dynamic languages are an excellent choice for many programming tasks and most of the time you are more productive using them. But they come with a price: they are slower than static typed languages and have a bigger memory footprint. Yesterday I compared the speed of Lua 5.1 with Lua on Parrot. The Parrot version is 230 times slower and uses about 450MB memory (for the debian mandelbrot benchmark). FUBAR.

Rakudo Perl fact of the day

August 4, 2010

Building Rakudo Perl 6 from source is slow and memory hungry. Using strace one can see that for instance compiling core.pm, which results in a 4.4 MB pir file, does 3078 brks and one single write. I’m sure that indicates something, but what?

Slow Parrot – Fast Perl?

June 22, 2010

To execute a program that calls an empty subroutine a million times does take on PIR/Parrot twice as long as Perl 5.10.1.

A dull Christmas?

June 21, 2010

Rakudo Star is coming on July 29. Time to re-evaluate Perl6. Haven’t looked at it closely for a few months, but I expect the following:

  1. Rakudo Perl6 will be terribly slow.
  2. Will use lots of memory.
  3. Will be to fragile for larger/long-running programs.
  4. Lots of bugs.
  5. Users will have a hard time to find out what is a bug/not implemented feature/change in spec/meaning of language constructs due to lack of documentation or ambiguous specs.
  6. Lack of bindings to native libraries.
  7. Lack of useful Perl6 modules.

Points 1/2/3/6 and partially 4 are mainly due to Parrot, the virtual machine that is the basis of Rakudo Perl6. Writing a compiler for a new language is hard, doing that and pushing the boundaries of dynamic languages really needs gigantic efforts, but doing it on top of Parrot is almost an impossible task. If there is a special hell for programmers I’m sure one of the punishments will be programming a complex dynamic language on top of Parrot. Is there a subsystem of Parrot that isn’t problematic? GC, IO, threading, api changes, the opcode zoo…

On the other hand Rakudo Perl6  is a prototype of a compiler for a subset of Perl6, and there is lots of opportunities for improving it. We will see.

The same procedure as every year…

April 18, 2010

I almost missed it: the empty while loop memory snatcher is back.

Perl 6 is different (Part 1)

April 15, 2010

Perl 6 is fun (for some definition of “fun”). Let’s look at these examples:

my $i=6;
if $i<4 { say "blabla"; }

or

my $i=6;
if $i>4 { say "maybe"; }

No problem so far, that is legal code (at least according to Pugs and Rakudo)

But look at this one:

my $i=6;
if $i<4 { say "blabla"; }
if $i>4 { say "maybe"; }

Oops! Won’t compile!

Who has a clue? Hint: if you swap those “if” statements it will compile (but the problem would be still there).

Stuck in the while loop

January 25, 2010

I wonder why the following code performs very different w.r.t. speed in NQP and Rakudo Perl 6:
my $i:=0;
while $i<1000000 { $i++ }

NQP is nearly a 100 times faster than Rakudo.

Premature optimization is the root of all evil…

October 20, 2009

… but software running at snail’s pace sucks. And software that has been developed for many years and is still very slow might have architectural problems or is crippled by arcane algorithms. I don’t assert that this is necessarily true for Parrot, but this is bad. In my previous entry I somehow stated that these PMCs are the problem, but without these PMCs Parrot wouldn’t be a specialized VM for dynamic languages. Parrot has to be very fast to be competitive. Parrot based compilers like Rakudo generate god-awful code and I’m sure that will be the case for a long time, and I’m confident that this isn’t a problem. My optimism is based the Clojure project, a LISP dialect based on the JVM. Clojure doesn’t try to output highly optimized Java bytecode, but relies on the superb optimizations by the JVM.

Btw. recent versions of Rakudo take 3.5 seconds for my loop: ./perl6 -e 'my Int $i=0; while $i<10000 { $i++ }'

Core business

July 1, 2009

Does the Parrot VM really need yet another runcore? I doubt it, because sometimes Parrot is reasonably fast, but it has two faces: the one if you use only these $Ixx registers, and the other one if you use those $Pxx registers (PMC, formerly known as Parrot Magic Cookie, OMG). Dynamic languages tend to use the PMC registers, the same is true for compilers like Rakudo that are far away from optimizing the generated code, Rakudo for instance doesn’t care about variables that were declared as integers (e.g. my int $var;).

It’s all about assumptions and mine are lousy, too. I thought Parrot is terribly slow because with Rakudo something like perl6 -e ‘my Int $i=0; while $i<10000 { $i++ }’ takes about 1.5 seconds on my Athlon XP machine. 150µs per loop iteration, a Z80 4Mhz CPU would do better. So I tried on my faster Athlon X2 machine to code something in Amd64 assembly code that mimics opcode dispatching. For a loop which counts down from 1 billion to 0 the direct threaded code took 34 seconds and the call threaded code took 9 seconds. That is 34ns rsp. 9ns per loop iteration. That sounds better! But something similar with PIR and Parrot using integer registers put that into perspective: with an optimized Parrrot 1.3.0 it took about one minute (not to bad) and with the jit runcore it took only 2.5 seconds! Wow! Only 2.5 times slower than a handwritten assembler program. (but the downside here is: on a faster Amd64 machine the same thing is slower, about 8 seconds)

The bottom line: don’t use PMCs


Follow

Get every new post delivered to your Inbox.