Profiling this program:
use v6;
my $fh = open '/usr/share/dict/words';
for $fh.lines {
1;
}
gives http://moritz.faui2k3.org/tmp/profile-1411722954.70066.html#routines
#!./perl6-m | |
use v6; | |
sub MAIN($path = '.') { | |
my $counter = 0; | |
my $callback = sub ($file) { | |
$counter++; | |
say $counter, "\t", $file.Str; | |
}; |
#!./perl6-j | |
use v6; | |
sub MAIN($path = '.') { | |
my $counter = 0; | |
my $callback = sub ($file) { | |
$counter++; | |
# say $counter, "\t", $file.Str; | |
}; |
use v6; | |
my ($classname, $message) = ('C', 'hi'); | |
my $class := 1.HOW.new_type(:name($classname)); | |
$class.^add_method('message', anon method message() { $message }); | |
$class.^compose(); | |
say $class.new.message(); |
use v6; | |
multi trait_mod:<is>(Routine:D $m, Mu $interface, :$declared-in!) { | |
my $name = $m.name; | |
unless $interface.^can($name) { | |
die "Method $name clames to be declared in {$interface.^name}, but there's no such method in {$interface.^name}!\n"; | |
} | |
} | |
role R { |
use v6; | |
multi trait_mod:<is>(Routine:D $m, Mu:$declared-in!) { | |
my $name = $m.name; | |
unless $declared-in.^can($name) { | |
die "Method $name claims to be declared in {$declared-in.^name}, but there's no such method in {$declared-in.^name}!\n"; | |
} | |
} | |
role R { |
use v6; | |
sub t ($x, $y, :$label = 'sum') { | |
say "$label: ", $x + $y; | |
} | |
sub namecall(&c, *@pos, *%named is rw) { | |
my %name-to-idx; | |
for &c.signature.params.kv -> $idx, $p { | |
next if $p.named; |
use v6; | |
my $str = slurp 'gistfile1.txt'; | |
sub test(Str $str) { | |
return not try { $str.perl; True }; | |
} | |
my $left = 0; | |
my $right = $str.chars; |
Profiling this program:
use v6;
my $fh = open '/usr/share/dict/words';
for $fh.lines {
1;
}
gives http://moritz.faui2k3.org/tmp/profile-1411722954.70066.html#routines
diff --git a/src/core/Str.pm b/src/core/Str.pm | |
index c0c886a..3590fbe 100644 | |
--- a/src/core/Str.pm | |
+++ b/src/core/Str.pm | |
@@ -1081,10 +1081,9 @@ my class Str does Stringy { # declared in BOOTSTRAP | |
} | |
multi method triage_substitution($_ where { .key ~~ Cool }) { | |
- return unless defined index($!source, .key, $!index); | |
- self.compare_substitution($_, |
use v6; | |
my $re = rx{ a+ }; | |
my $str = 'ab'; | |
my $grammar := (grammar {}).HOW.new_type(); | |
my $HOW := $grammar.HOW; | |
$HOW.add_method($grammar, 'trans', my proto token trans {*}); | |
$HOW.add_method($grammar, "trans:sym<1>", $re); | |
$HOW.add_method($grammar, "trans:sym<2>", regex { $str }); |