-
-
Save stmuk/5f2f086733e084d5d829 to your computer and use it in GitHub Desktop.
Slow Perl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FAQ But is Rakudo fast enough for me? |
Perl6:
real 0m0.595s
user 0m0.464s
sys 0m0.080s
Perl5 (5.20):
real 0m0.577s
user 0m0.488s
sys 0m0.044s
Perl5 (5.22):
real 0m0.540s
user 0m0.472s
sys 0m0.024s
please remove the superstitious parens in the perl6 example. thanks :)
oh, and also: rakudo's currently not turning for loops into loop loops when you loop over a range of known values like it used to; i was hoping i could get it into the release that's going to happen soon (or happened today already??) but i'm ill and struggling to concentrate :(
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That depends on what you are doing. Rakudo has been developed with the philosophy of "make it work right then make it work fast". It's fast for some things already but needs work on others.
Perl 6 is mostly being worked on by volunteers but it's expected that Perl 6 performance will improve in the near future since the MoarVM backend contains a modern Just In Time (JIT) compiler.
Perl 5 programmers should be aware that Perl 6 comes with more built in in terms of object orientation and much else. Simple benchmarks will be misleading unless you include things like Moose, type checking modules etc. in your Perl 5 script.
The following crude benchmarks, with all the usual caveats about such things, can show Perl 6 to be of roughly equivalent speed to Perl 5 for some similar common tasks.
Try it on your system you may be pleasantly surprised.
Example:
package Foo;
use 5.10.0;
use Moose;
has i => ( is=> 'rw');
for my $i (1..10000) {
my $obj = Foo->new;
$obj->i($i);
say $obj->i;
}
use v6;
class Foo { has $.i is rw};
for (1..10000) -> $i {
my $obj = Foo.new;
$obj.i = $i;
say $obj.i;
}