Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
go-loop.sh - perl6 vs. perl5 time -v
perl (Perl 5) version:
This is perl 5, version 22, subversion 0 (v5.22.0) built for x86_64-linux-thread-multi
perl6 (Perl 6) version:
This is Rakudo version 2017.06-133-ga7b2304 built on MoarVM version 2017.06-35-g3d3d0d0
implementing Perl 6.c.
perl 5 - simple int loop: ok
Command being timed: "perl -e my $i = 0; while (($i = $i + 1) <= 100000000) { }; print "ok\n";"
User time (seconds): 4.17
System time (seconds): 0.00
Percent of CPU this job got: 99%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:04.17
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 4208
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 189
Voluntary context switches: 1
Involuntary context switches: 6
Swaps: 0
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
perl 5 - simple int loop (use integer): ok
Command being timed: "perl -e use integer; my $i = 0; while (($i = $i + 1) <= 100000000) { }; print "ok\n";"
User time (seconds): 3.85
System time (seconds): 0.00
Percent of CPU this job got: 99%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:03.86
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 4224
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 193
Voluntary context switches: 1
Involuntary context switches: 4
Swaps: 0
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
perl 6 - simple int loop (MVM_JIT_DISABLE=1): ok
Command being timed: "perl6 -e my int $i = 0; while ($i = $i + 1) <= 100000000 { }; say "ok";"
User time (seconds): 3.29
System time (seconds): 0.01
Percent of CPU this job got: 99%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:03.31
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 70188
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 12593
Voluntary context switches: 1
Involuntary context switches: 9
Swaps: 0
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
perl 6 - simple int loop: ok
Command being timed: "perl6 -e my int $i = 0; while ($i = $i + 1) <= 100000000 { }; say "ok";"
User time (seconds): 0.75
System time (seconds): 0.01
Percent of CPU this job got: 99%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.76
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 70696
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 12708
Voluntary context switches: 1
Involuntary context switches: 0
Swaps: 0
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
perl5 - empty print: ok
Command being timed: "perl -e print "ok\n""
User time (seconds): 0.00
System time (seconds): 0.00
Percent of CPU this job got: 100%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.00
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 4188
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 187
Voluntary context switches: 1
Involuntary context switches: 0
Swaps: 0
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
perl5 - Moose, empty print: ok
Command being timed: "perl -e use Moose; print "ok\n""
User time (seconds): 0.18
System time (seconds): 0.02
Percent of CPU this job got: 34%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.61
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 21116
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 8
Minor (reclaiming a frame) page faults: 4303
Voluntary context switches: 216
Involuntary context switches: 1
Swaps: 0
File system inputs: 12696
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
perl6 rakudo - empty say: ok
Command being timed: "perl6 -e say "ok";"
User time (seconds): 0.09
System time (seconds): 0.01
Percent of CPU this job got: 99%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.10
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 67632
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 12021
Voluntary context switches: 1
Involuntary context switches: 1
Swaps: 0
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
Script used to run this test:
#!/bin/bash
# > cd ~/devel/perl6
# > git clone git@github.com:rakudo/rakudo.git
# > cd rakudo
# > perl Configure.pl --backends=moar --gen-moar=master --moar-option="--enable-jit" --gen-nqp=master
# > make
# > make install
set -e
echo "perl (Perl 5) version:"
perl -v | head -n2 | tail -n1
echo
echo "perl6 (Perl 6) version:"
perl6 -v
echo
echo -n "perl 5 - simple int loop: "
/usr/bin/time -v perl -e 'my $i = 0; while (($i = $i + 1) <= 100000000) { }; print "ok\n";'
echo
echo -n "perl 5 - simple int loop (use integer): "
/usr/bin/time -v perl -e 'use integer; my $i = 0; while (($i = $i + 1) <= 100000000) { }; print "ok\n";'
echo
echo -n "perl 6 - simple int loop (MVM_JIT_DISABLE=1): "
MVM_JIT_DISABLE=1 /usr/bin/time -v perl6 -e 'my int $i = 0; while ($i = $i + 1) <= 100000000 { }; say "ok";'
echo
echo -n "perl 6 - simple int loop: "
/usr/bin/time -v perl6 -e 'my int $i = 0; while ($i = $i + 1) <= 100000000 { }; say "ok";'
echo
echo -n "perl5 - empty print: "
/usr/bin/time -v -v perl -e 'print "ok\n"'
echo
echo -n "perl5 - Moose, empty print: "
/usr/bin/time -v perl -e 'use Moose; print "ok\n"'
echo
echo -n "perl6 rakudo - empty say: "
/usr/bin/time -v perl6 -e 'say "ok";'
echo
echo "Script used to run this test:"
cat go-loop.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.