http://www.perlmonks.org?node_id=1099654


in reply to Re: Rakudo Perl 6 and MoarVM Performance Advances
in thread Rakudo Perl 6 and MoarVM Performance Advances

.lines() and -n are really really slow in rakudo, the code behind that is not really clever, compared to the code in Perl 5 (there is a talk by leont about what P5 does there).

This should be better:

perl6 -e 'grammar G { token TOP { <line>* }; token line { \N*\n } }; class A { method line($m) { say ~$0 if $m ~~ m/(<<\w**5>>)/ } }; G.parse(slurp(), :actions(A))'

If tested that on a file from my box, result:

Perl 5: 0.2s

Perl 6: 6.2s

That would mean that it might take about 45s on your box... can you verify that?

Note 1) String handling is the slowest part in rakudo atm.

Note 2) You should not compare printing the .gist of a match to a string from another language. Because Date::Dumper-ing an object in P5 is not really fast either. And that is what .gist somewhat is. (.gist is the human friendly nice formatted version of Data::Dumper aka method .perl)

Note 3) I promised to look into the cheats P5 does when walking over lines, and I'll do that this weekend.