[tpm] Perl 6 performance relative to Perl 5.10
arocker at Vex.Net
arocker at Vex.Net
Sat Apr 30 13:06:31 PDT 2011
> Hey guys.
>
> I had that looping problem when I was playing with Rakudo last year. It's
> not actually slow looping, it's slow lists.
>
> $ time perl6 -e 'my ($x, $a) = (0,0); while ($a < 10000) { $a++; $x++};
> say $x'
> 10000
>
> real 0m6.688s
> user 0m6.204s
> sys 0m0.408s
>
What kind of environment are you running? BSD?
Removing the list certainly sped up the job, (output edited for legibility);
time ./perl6 -e "my \$x = 0; while \$x < 100000 {\$x++}; say \"\$x\";"
100000
17.30 user (similar numbers for several tries)
0.14 system
0:20.35 elapsed 85% CPU (0 avgtext + 0 avgdata 313136 maxresident)k
0 inputs + 0 outputs (0 major + 21031 minor)pagefaults 0 swaps
To compare my results to yours, using the same number of iterations:
time ./perl6 -e "my \$x = 0; while \$x < 10000 {\$x++}; say \"\$x\";"
10000
2.54 user
0.04 system
0:03.03 elapsed 84% CPU (0 avgtext + 0 avgdata 287248 maxresident)k
0 inputs + 0 outputs (0 major + 18020 minor)pagefaults 0 swaps
Adding the additional variable to increment to make it directly comparable:
3.76 user
0.08 system
0:04.69 elapsed
More information about the toronto-pm
mailing list