Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add an option to display stats on @*MEMOS usage

  • Loading branch information...
commit 7376b1078ddd1ac10b3d6d48c991167c71414a64 1 parent de628e4
@sorear authored
Showing with 13 additions and 0 deletions.
  1. +13 −0 src/NieczaFrontendSTD.pm6
View
13 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);
Please sign in to comment.
Something went wrong with that request. Please try again.