Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
go-mj.sh - say $_ for 1..2_000_000
Date:
Mon Jul 3 22:49:03 CEST 2017
perl (Perl 5) version:
This is perl 5, version 22, subversion 0 (v5.22.0) built for x86_64-linux-thread-multi
nqp version:
This is nqp version 2017.06-31-gf216702 built on MoarVM version 2017.06-35-g3d3d0d0
perl6 (Perl 6) version:
This is Rakudo version 2017.06-133-ga7b2304 built on MoarVM version 2017.06-35-g3d3d0d0
implementing Perl 6.c.
perl5 - empty print
real 0m0.004s
user 0m0.001s
sys 0m0.002s
perl5 - Moose, empty print
real 0m0.161s
user 0m0.150s
sys 0m0.010s
perl5 - foreach print
real 0m0.236s
user 0m0.229s
sys 0m0.006s
perl5 - Moose, foreach print
real 0m0.396s
user 0m0.384s
sys 0m0.010s
nqp-m - empty say
real 0m0.020s
user 0m0.013s
sys 0m0.007s
nqp-m - while print
real 0m3.866s
user 0m3.211s
sys 0m0.644s
nqp-m - while say
real 0m4.346s
user 0m3.718s
sys 0m0.618s
perl6 rakudo - empty say
real 0m0.121s
user 0m0.102s
sys 0m0.018s
perl6 rakudo - foreach say
real 0m8.682s
user 0m7.994s
sys 0m0.671s
perl6 rakudo - while loop say
real 0m10.556s
user 0m9.766s
sys 0m0.764s
Number of lines in result files:
2000000 /tmp/mj-p6-test/many-nqp-m-print-while
2000000 /tmp/mj-p6-test/many-perl-print-foreach
2000000 /tmp/mj-p6-test/many-perl-print-foreach-moose
2000000 /tmp/mj-p6-test/many-rakudo-say-foreach
2000000 /tmp/mj-p6-test/many-rakudo-say-while
1 /tmp/mj-p6-test/one-nqp-m-print
1 /tmp/mj-p6-test/one-perl-print
1 /tmp/mj-p6-test/one-perl-print-moose
1 /tmp/mj-p6-test/one-rakudo-say
10000004 total
Script used to run this test:
#!/bin/bash
# > cd ~/devel/perl6
# > git clone git@github.com:rakudo/rakudo.git
# > cd rakudo
# > perl Configure.pl --backends=moar --gen-moar=master --moar-option="--enable-jit" --gen-nqp=master
# > make
# > make install
set -e
rm -f /tmp/mj-p6-test/*
mkdir -p /tmp/mj-p6-test/
echo "Date:"
date
echo
echo "perl (Perl 5) version:"
perl -v | head -n2 | tail -n1
echo
echo "nqp version:"
nqp-m --version
echo
echo "perl6 (Perl 6) version:"
perl6 -v
echo
echo -n "perl5 - empty print"
time perl -e 'print "ok\n"' > /tmp/mj-p6-test/one-perl-print
echo
echo -n "perl5 - Moose, empty print"
time perl -e 'use Moose; print "ok\n"' > /tmp/mj-p6-test/one-perl-print-moose
echo
echo -n "perl5 - foreach print"
time perl -e 'print "$_\n" foreach 1..2_000_000' > /tmp/mj-p6-test/many-perl-print-foreach
echo
echo -n "perl5 - Moose, foreach print"
time perl -MMoose -e 'print "$_\n" foreach 1..2_000_000' > /tmp/mj-p6-test/many-perl-print-foreach-moose
echo
echo -n "nqp-m - empty say"
time nqp-m -e'say("ok");' > /tmp/mj-p6-test/one-nqp-m-print
echo
echo -n "nqp-m - while print"
time nqp-m -e 'my int $i := 0; while ($i := $i + 1) <= 2000000 { print("$i\n"); };' > /tmp/mj-p6-test/many-nqp-m-print-while
echo
echo -n "nqp-m - while say"
time nqp-m -e 'my int $i := 0; while ($i := $i + 1) <= 2000000 { say("$i"); };' > /tmp/mj-p6-test/many-nqp-m-print-while
echo
echo -n "perl6 rakudo - empty say"
time perl6 -e 'say "ok";' > /tmp/mj-p6-test/one-rakudo-say
echo
echo -n "perl6 rakudo - foreach say"
time perl6 -e 'say $_ for 1..2_000_000;' > /tmp/mj-p6-test/many-rakudo-say-foreach
echo
echo -n "perl6 rakudo - while loop say"
time perl6 -e 'my int $i = 0; while ($i = $i + 1) <= 2_000_000 { say $i };' > /tmp/mj-p6-test/many-rakudo-say-while
echo
echo "Number of lines in result files:"
wc -l /tmp/mj-p6-test/*
echo
echo "Script used to run this test:"
cat go-mj.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.