[Purdue-pm] correction: Perl 5 reads lines 11.7 times faster
Mark Senn
mark at purdue.edu
Sat Oct 22 18:10:20 PDT 2016
The following is a correction to an earlier message I sent that was
inspired by a message from Tom Browder to the perl6-bugs-followup
mailing list. The biggest problem with the previous message from me was
the subject line read "Perl 6 reads lines 11.7 times faster". Sheesh.
| 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 based on total execution times.
|
| 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