[tpm] Perl 6 performance relative to Perl 5.10
arocker at Vex.Net
arocker at Vex.Net
Fri Apr 29 11:33:09 PDT 2011
I decided to get some numbers to add to last night's discussion. To test
the basic overhead, I used a minimal command-line program.
As a baseline, the system Perl, 5.10.1 returned the following:
time perl -e ";"
0.00 user 0.01 system 0:00.01 elapsed 100%CPU (0 avgtext + 0 avgdata
5712 maxresident)k (When re-run, even the 1s disappeared.)
0 inputs + 0 outputs (0 major + 419 minor)pagefaults 0 swaps
Perl 6, run 3 times to eliminate the influence of Linux' aggressive caching:
time ./perl6 -e ";"
1.52 user 0.16 system 0:02.37 elapsed 70% CPU (0 avgtext + 0 avgdata
263456 maxresident)k
18384 inputs + 0 outputs (45 major+ 16487 minor)pagefaults 0 swaps
time ./perl6 -e ";"
1.13 user 0.06 system 0:01.33 elapsed 88% CPU (0 avgtext + 0 avgdata
263440 maxresident)k
0 inputs + 0 outputs (0 major + 16531 minor)pagefaults 0 swaps
time ./perl6 -e ";"
1.25 user 0.14 system 0:01.51 elapsed 91% CPU (0 avgtext + 0 avgdata
263440 maxresident)k
0 inputs + 0 outputs (0 major + 16531 minor)pagefaults 0 swaps
(I'm at a loss to explain the increase on the 3rd try of Perl 6.)
Giving the program something real to do seems to add very little work:
time perl -e 'print "present\n";'
present
0.00 user 0.00 system 0:00.00 elapsed 0% CPU (0 avgtext + 0 avgdata
6096 maxresident)k
0 inputs + 0 outputs (0 major + 443 minor)pagefaults 0 swaps
time ./perl6 -e "say 'present';"
present
1.22 user 0.09 system 0:01.41 elapsed 92% CPU (0 avgtext + 0 avgdata
263600 maxresident)k
0 inputs + 0 outputs (0 major + 16542 minor)pagefaults 0 swaps
time ./perl6 -e "say 'present';"
present
1.39 user 0.21 system 0:01.76 elapsed 90% CPU (0 avgtext + 0 avgdata
263616 maxresident)k
0 inputs + 0 outputs (0 major + 16542 minor)pagefaults 0 swaps
To see the effect of a reasonable number of arithmetic operations:
time perl -e "my \$x; for (1..100000){\$x++}; print \"\$x\n\";"
100000
0.01 user 0.00 system 0:00.02 elapsed 45% CPU (0 avgtext + 0 avgdata
6352 maxresident)k
0 inputs + 0 outputs (0 major + 459 minor)pagefaults 0 swaps
time ./perl6 -e "my \$x; for 1..100000 {\$x++}; say \"\$x\";"
100000
55.59 user 0.75 system 1:02.7 0elapsed 89% CPU (0 avgtext + 0 avgdata
601952 maxresident)k
0 inputs + 0 outputs (0 major + 40452 minor)pagefaults 0 swaps
Rather significant differences.
More information about the toronto-pm
mailing list