Last active
August 29, 2015 14:13
-
-
Save peschwa/79a3922f40f3f6343165 to your computer and use it in GitHub Desktop.
This file contains 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
psch@hack:~/rakudo/Grammar-Profiler-Simple$ git diff | |
diff --git a/lib/Grammar/Profiler/Simple.pm b/lib/Grammar/Profiler/Simple.pm | |
index fcf874a..477e01a 100644 | |
--- a/lib/Grammar/Profiler/Simple.pm | |
+++ b/lib/Grammar/Profiler/Simple.pm | |
@@ -6,15 +6,16 @@ my class ProfiledGrammarHOW is Metamodel::GrammarHOW { | |
my $meth := callsame; | |
substr($name, 0, 1) eq '!' || | |
substr($name, 0, 8) eq 'dispatch' || | |
- $name eq any(« parse CREATE Bool defined MATCH Stringy Str WHERE orig BUILD DESTROY ») ?? | |
+ $name eq any(« WHICH parse CREATE Bool defined MATCH Stringy Str WHERE orig BUILD DESTROY ») ?? | |
$meth !! | |
-> $c, |args { | |
+ say $obj === $c; | |
my $grammar = $obj.^name; | |
%timing{$grammar} //= {}; # Vivify grammar hash | |
%timing{$grammar}{$meth.name} //= {}; # Vivify method hash | |
my %t := %timing{$grammar}{$meth.name}; | |
my $start = now; | |
- my $result := $meth($obj, |args); | |
+ my $result := $meth($c, |args); | |
%t<time> += now - $start; | |
%t<calls>++; | |
$result |
This file contains 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
psch@hack:~/rakudo/Grammar-Profiler-Simple$ PERL6LIB=lib prove -v -e perl6-j t/ | |
t/csv.t .. | |
1..15 | |
True | |
True | |
True | |
ok 1 - Rule ``value'' was called 1 times | |
ok 2 - Rule ``line'' was called 1 times | |
ok 3 - Rule ``TOP'' was called 1 times | |
True | |
False | |
False | |
ok 4 - Rule ``value'' was called 2 times | |
ok 5 - Rule ``line'' was called 2 times | |
ok 6 - Rule ``TOP'' was called 2 times | |
True | |
False | |
False | |
False | |
False | |
False | |
ok 7 - Rule ``value'' was called 6 times | |
ok 8 - Rule ``line'' was called 3 times | |
ok 9 - Rule ``TOP'' was called 3 times | |
True | |
False | |
False | |
ok 10 - Rule ``value'' was called 7 times | |
ok 11 - Rule ``line'' was called 4 times | |
ok 12 - Rule ``TOP'' was called 4 times | |
True | |
False | |
False | |
False | |
False | |
False | |
False | |
False | |
False | |
ok 13 - Rule ``value'' was called 14 times | |
ok 14 - Rule ``line'' was called 5 times | |
ok 15 - Rule ``TOP'' was called 5 times | |
ok | |
All tests successful. | |
Files=1, Tests=15, 10 wallclock secs ( 0.03 usr 0.00 sys + 24.66 cusr 0.43 csys = 25.12 CPU) | |
Result: PASS |
This file contains 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
psch@hack:~/rakudo/Grammar-Profiler-Simple$ PERL6LIB=lib prove -v -e perl6-m t/ | |
t/csv.t .. | |
1..15 | |
True | |
True | |
True | |
ok 1 - Rule ``TOP'' was called 1 times | |
ok 2 - Rule ``line'' was called 1 times | |
ok 3 - Rule ``value'' was called 1 times | |
True | |
True | |
True | |
ok 4 - Rule ``TOP'' was called 2 times | |
ok 5 - Rule ``line'' was called 2 times | |
ok 6 - Rule ``value'' was called 2 times | |
True | |
True | |
True | |
True | |
True | |
True | |
ok 7 - Rule ``TOP'' was called 3 times | |
ok 8 - Rule ``line'' was called 3 times | |
ok 9 - Rule ``value'' was called 6 times | |
True | |
True | |
True | |
ok 10 - Rule ``TOP'' was called 4 times | |
ok 11 - Rule ``line'' was called 4 times | |
ok 12 - Rule ``value'' was called 7 times | |
True | |
True | |
True | |
True | |
True | |
True | |
True | |
True | |
True | |
ok 13 - Rule ``TOP'' was called 5 times | |
ok 14 - Rule ``line'' was called 5 times | |
ok 15 - Rule ``value'' was called 14 times | |
ok | |
All tests successful. | |
Files=1, Tests=15, 0 wallclock secs ( 0.02 usr 0.01 sys + 0.82 cusr 0.06 csys = 0.91 CPU) | |
Result: PASS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment