~ readme ~

~ readme ~

         .ooo
          'OOOo
      ~ p ooOOOo tion ~
          .OOO
           oO      %% a little
             Oo    fast language.
            'O
             `
            (o)
        ___/ /
       /`    \
      /v^  `  ,
     (...v/v^/
      \../::/
       \/::/

p2 is a she. She is a perl5 and possible perl6/nqp backend, based on why the luck stiff’s potion. See README.potion.md why potion is exciting. Homepage: http://perl11.com/p2/

Command Time
parrot example/fib.pir 28 0m1.746s
perl example/fib.pl 28 0m0.439s
p2 -B example/fib.p2 28 0m0.177s
potion example/fib.pn 28 0m0.013s
p2 example/fib.p2 28 0m0.013s
perl example/fib.p2 28 0m0.196s
raku example/fib.p6 28 0m0.569s
p2 example/fib.p6 28 0m0.018s
parrot example/fib.pir 40 3m36.447s
perl example/fib.pl 40 2m19.752s
p2 -B example/fib.p2 40 1m1.940s
potion example/fib.pn 40 0m3.063s
p2 example/fib.p2 40 0m3.105s
raku example/fib.p6 40 1m29.872s
p2 example/fib.p6 40 0m3.086s

For most small examples comparable performance to lua and C. Mostly 10x faster than perl5, and ~200x faster than raku. For bigger examples optimizable via static types/early binding.

Its exciting points for perl folks are:

However, some warnings:

~ compiler backends ~

--compile=BACKEND (potion and p2) transforms the program into another form:

~ benchmarks ~

test/bench-summary.sh (RUNS=3 for the best of three). Wall clock seconds; the exe columns are --compile=exe builds. x is the time relative to pn for the pn column, to perl for the pl columns and to raku for the p6 columns.

program pn pn exe (x pn) pl p2 (x perl) pl perl pl exe (x perl) p6 p2 (x raku) p6 raku p6 exe (x raku)
ackermann 0.012 0.013 (1.1x) 0.023 (3.8x) 0.006 0.010 (1.7x) 0.052 (0.1x) 0.374 0.050 (0.1x)
fib 0.017 0.015 (0.9x) 0.044 (0.2x) 0.205 0.035 (0.2x) 0.034 (0.1x) 0.623 0.022 (0.0x)
fib.p2 0.017 0.017 (1.0x) 0.027 (0.1x) 0.211 0.021 (0.1x) - - -
nqueens 0.013 0.011 (0.8x) 0.092 (8.4x) 0.011 0.055 (5.0x) 0.039 (0.1x) 0.397 0.032 (0.1x)
spectral-norm 0.210 0.203 (1.0x) 0.302 (1.6x) 0.191 0.254 (1.3x) 0.492 (0.2x) 2.155 0.408 (0.2x)

The runs are very short, so the ratios are noisy.

~ debugger ~

There is now a full interactive debugger with readline, to evaluate and inspect all internals at runtime. See doc/debugger.md.

~ building and installing ~

make
make install

Look inside the file called INSTALL.md for options.

To debug the interpreter (gdb sessions, the AST and bytecode dumps, how globals, mixins and control keywords work, the threading model) see doc/INTERNALS.md.

~ feverish and fond thankyous ~

why the lucky stiff left the ruby community. potion was his last public project. It’s a work of great art and mastership. I could not think of anything better. I think it is better than Go, if potion would have had added auto-threads and channels.

Rob Pike for Go, and the parrot community for parrot.

Larry Wall for perl5. We miss his leadership and technical excellence. Without him nothing got done, and if something was done it was wrong. Besides defined-or, which left Tom Christiansen behind.

why the lucky stiff thanks:

why is gravely indebted to Basile Starynkevitch, who fielded questions about his garbage collector. why favors French hackers to an extreme (Xavier Leroy, Nicolas Cannasse, Guy Decoux, Mathieu Bochard to name only a portion of those he admires) and is very glad to represent their influence in Potion’s garbage collector.

Matz, for answering why’s questions about conservative GC and for encouraging him so much. Potion’s stack scanning code and some of the object model come from Ruby.

Steve Dekorte for the Io language, libgarbagecollector and libcoroutine – He referred frequently to all of them in sorting out what he wanted.

Of course, Mauricio Fernandez for his inspiring programming journal housed at http://eigenclass.org/R2/ and for works derived throughout the course of it – extprot most of all. Many of my thoughts about language internals (object repr, GC, etc.) are informed by him.

Ian Piumarta for peg/leg. We use a re-entrant customized version of it, but the original library is sheer minimalist parsing amazement.

Final appreciations to Jonathan Wright and William Morgan who pitched in, back in the wee hours of Potion’s history. Thanks.

~ license ~

See COPYING for legal information. potion is MIT licensed, which lets you do anything you want with this. p2 and perl6 code is ARTISTIC 2 licensed.