Permalink
Browse files

Add an option to display stats on @*MEMOS usage

  • Loading branch information...
1 parent de628e4 commit 7376b1078ddd1ac10b3d6d48c991167c71414a64 @sorear committed Feb 27, 2012
Showing with 13 additions and 0 deletions.
  1. +13 −0 src/NieczaFrontendSTD.pm6
@@ -280,6 +280,19 @@ method parse(:$unitname, :$filename, :$source, :$outer, :$run, :$main, :$evalmod
NieczaGrammar.parse($source, actions => $Actions);
+ if %*ENV<NIECZA_MEMO_INFO> {
+ say "Memos used for $*UNITNAME ($source.chars() positions):";
+ my %memo_count;
+ for @*MEMOS -> $memo {
+ for $memo.keys -> $key {
+ ++%memo_count{$key}
+ }
+ }
+ for %memo_count.kv -> $key, $ct {
+ say "{$ct.fmt('%05d')} $key";
+ }
+ }
+
@STD::herestub_queue = @save_herestub;
$*backend.accept($*unit, :$filename, :$run, :$evalmode, :$repl);

0 comments on commit 7376b10

Please sign in to comment.