dp_z (dp_z) wrote in ru_perl,
dp_z
dp_z
ru_perl

MoarVM performance


=================1=====================
$time perl -e 'my $x=0; $x++ while $x < 300000000; print $x;'
300000000
real 0m12.047s
user 0m12.040s
sys 0m0.000s
=================2=====================
$perl6 -v
This is Rakudo version 2017.07 built on MoarVM version 2017.07
implementing Perl 6.c.
=================3=====================
$time perl6 -e 'my $x=0; $x++ while $x < 300000000; print $x;'
300000000
real 0m46.730s
user 0m46.664s
sys 0m0.024s
=================4=====================
$time perl6 -e 'my Int $x=0; $x++ while $x < 300000000; print $x;'
300000000
real 0m46.925s
user 0m46.840s
sys 0m0.028s
=================5=====================
$time perl6 -e 'my int $x=0; $x++ while $x < 300000000; print $x;'
300000000
real 0m2.390s
user 0m2.356s
sys 0m0.028s
=================6=====================
$time perl6 -e 'my uint $x=0; $x++ while $x < 300000000; print $x;'
300000000
real 0m12.103s
user 0m12.060s
sys 0m0.020s
=================7=====================
$time perl6 -e 'say (1..300000000).elems'
300000000
real 0m0.165s
user 0m0.144s
sys 0m0.020s
=================8=====================
$time perl -e '$s+=$x++ while $x < 30000000; print $s;'
449999985000000
real 0m2.336s
user 0m2.332s
sys 0m0.000s
=================9=====================
$time perl6 -e 'my int $x=0; my int $s=0; $s+=$x++ while $x < 30000000; say $s;'
449999985000000
real 0m17.609s
user 0m16.640s
sys 0m0.948s
=================10=====================
$time perl6 -e 'my uint $x=0; my uint $s=0; $s+=$x++ while $x < 30000000; say $s;'
449999985000000
real 0m21.325s
user 0m20.320s
sys 0m0.964s
=================11=====================
$time perl6 -e 'say [+] 1..29999999'
449999985000000
real 0m0.164s
user 0m0.124s
sys 0m0.036s

Мораль:  элементы быстродействия присутствуют, но странностей много (5 vs 6 и 8 vs 9)
Tags: perl6
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 3 comments
> my Int $x

дебилы бля
а это точно имеет смысл проверять?
Вопрос не понял.