[Purdue-pm] Perl 6 reads lines 11.7 times faster

Mark Daniel Ward mdw at purdue.edu
Sat Oct 22 18:11:22 PDT 2016


Dear Mark,

Your subject line said Perl 6 is faster but the body of your email said Perl 5 was faster.  Which is it?

Mark

Sent from my iPod

> On Oct 22, 2016, at 5:35 PM, Mark Senn <mark at purdue.edu> wrote:
> 
> I ran the following Perl 5 and Perl 6 programs three times each and
> averaged the results.  The Perl 5 program read the one million line file
> (each line was 99 x's followed by a newline) 11.7 times faster than the
> Perl 6 program.
> 
> Perl 5 program:
> % perl --version
> This is perl 5, version 22, subversion 0 (v5.22.0) built for
> x86_64-linux-thread-multi
>    my $fn = '/tmp/mark/z';
>    open $fh, '<', $fn;
>    my $n = 0;
>    while (<$fh>)
>    {
>        $n++;
>    }
>    print "$n\n";
> 
> Perl 6 program:
> % perl6 --version
> This is Rakudo version 2016.10 built on MoarVM version 2016.10
> implementing Perl 6.c.
>    my $fn = '/tmp/mark/z';
>    my $fh = open $fn, :r;
>    my $n = 0;
>    for $fh.lines
>    {
>        $n++;
>    }
>    say $n;
> 
> Perl 6 continues to get faster.  I like it _much_ better than Perl 5.
> 
> -mark
> _______________________________________________
> Purdue-pm mailing list
> Purdue-pm at pm.org
> http://mail.pm.org/mailman/listinfo/purdue-pm



More information about the Purdue-pm mailing list