This file contains hidden or 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
pir::nqp_bigint_setup__v(); | |
my $knowhow := pir::get_knowhow__P(); | |
my $bi_type := $knowhow.HOW.new_type(:name('TestBigInt'), :repr('P6bigint')); | |
$bi_type.HOW.compose($bi_type); | |
sub fac_bi($n) { | |
my $i := $n; | |
my $r := nqp::box_i(1, $bi_type); | |
while $i > 1 { |
This file contains hidden or 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
pir::nqp_bigint_setup__v(); | |
my $knowhow := pir::get_knowhow__P(); | |
my $bi_type := $knowhow.HOW.new_type(:name('TestBigInt'), :repr('P6bigint')); | |
$bi_type.HOW.compose($bi_type); | |
my $bi1 := nqp::create($bi_type); | |
say(nqp::unbox_i($bi1)); | |
my $bi2 := nqp::box_i(42, $bi_type); |
This file contains hidden or 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
# uncaught class | |
class Dandy is Exception {}; | |
my ($naughty, $lived); | |
{ | |
die Dandy.new(); | |
CATCH { | |
when Naughty { | |
$naughty = 1; |
This file contains hidden or 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
diff --git a/src/Perl6/Actions.pm b/src/Perl6/Actions.pm | |
index b6188d5..d6f8836 100644 | |
--- a/src/Perl6/Actions.pm | |
+++ b/src/Perl6/Actions.pm | |
@@ -3247,7 +3247,10 @@ class Perl6::Actions is HLL::Actions { | |
method postcircumfix:sym<[ ]>($/) { | |
my $past := PAST::Op.new( :name('postcircumfix:<[ ]>'), :pasttype('callmethod'), :node($/) ); | |
- if $<semilist><statement> { $past.push($<semilist>.ast); } | |
+ if $<semilist><statement> { |
This file contains hidden or 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
diff --git a/src/Perl6/Actions.pm b/src/Perl6/Actions.pm | |
index b6188d5..5c6ffe6 100644 | |
--- a/src/Perl6/Actions.pm | |
+++ b/src/Perl6/Actions.pm | |
@@ -2768,6 +2768,9 @@ class Perl6::Actions is HLL::Actions { | |
:pasttype('callmethod'), :name('FLATTENABLE_HASH'), | |
$_[0], :flat(1), :named(1))); | |
} | |
+ elsif $_<boxable_native> { | |
+ $past.push($_[2]); |
This file contains hidden or 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
use v5.10; | |
use Time::HiRes qw(time); | |
my $t = time(); | |
system('perl -E "my $i = 0; while ($i < 10000000) { $i = $i + 1 }; say $i"'); | |
say time() - $t; | |
$t = time(); | |
system('perl6 --optimize=3 -e "my int $i = 0; while $i < 10000000 { $i = $i + 1 }; say $i"'); | |
say time() - $t; |
This file contains hidden or 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
BEFORE | |
C:\consulting\rakudo>perl6 -e "my $t = now; my $i = 0; for 1..10000 { $i++ }; sa y $i; say now - $t" | |
10000 | |
0.124 | |
C:\consulting\rakudo>perl6 -e "my $t = now; my $i = 0; for 1..100000 { $i++ }; s ay $i; say now - $t" | |
100000 | |
3.714 |
This file contains hidden or 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
.sub 'main' | |
add $I100, 4294967295, 4294967295 | |
say $I100 | |
.end |
This file contains hidden or 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
Optimizing Rakudo Perl 6 | |
After much work, the Rakudo implementation of Perl 6 now supports a lot of the features | |
laid out in the Perl 6 language specification. For many potential users, missing features | |
are not a great blocker; today, performance is a much more important one. Now the foundations | |
are laid, current work on Rakudo involves a focus on implementing optimizers, and optimizing | |
the compiler and runtime environment itself. | |
While there's a long way to go, this work has already produced results; for example, Rakudo | |
at the time of writing runs a Mandelbrot benchmark almost 20 times faster than it could earlier |
This file contains hidden or 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
C:\consulting\rakudo>type mp.p6 | |
multi foo(Str $a) { } | |
multi foo() { } | |
say &foo.candidates_matching('lol').elems; | |
say &foo.candidates_matching(42).elems; | |
say &foo.candidates_matching().elems; | |
C:\consulting\rakudo>perl6 mp.p6 | |
1 |