Skip to content

Instantly share code, notes, and snippets.

@pmichaud
Created June 30, 2012 23:26
Show Gist options
  • Select an option

  • Save pmichaud/3025994 to your computer and use it in GitHub Desktop.

Select an option

Save pmichaud/3025994 to your computer and use it in GitHub Desktop.
The following uses the new --stagestats option to report on the amount
of memory consumed and PMCs allocated at each stage of compilation.
I'm running it on four NQP scripts; each script has one more "say(n);"
statement than the one before it.
-------Memory=------ ------PMCs------
Sec Alloc Used Total Active
pmichaud@kiwi:~/p6/nqp$ for i in x1 x2 x3 x4; do echo "$i:"; cat $i; ./nqp --stagestats=2 $i >/dev/null; echo ""; done
x1:
say(1);
Stage start : 0.000 7294976 5887747 41820 41508
Stage parse : 0.048 20795392 18388950 137700 137406
Stage past : 0.000 20803584 18401440 137700 137469
Stage post : 0.004 22114304 19641141 143310 143189
Stage pir : 0.001 22589440 20139592 145860 145452
Stage evalpmc : 0.002 22904832 20196396 145860 145647
x2:
say(1);
say(2);
Stage start : 0.000 7294976 5887779 41820 41508
Stage parse : 0.051 21258240 18825625 140250 140154
Stage past : 0.000 21270528 18838115 140250 140217
Stage post : 0.004 22646784 20132386 146370 146189
Stage pir : 0.001 23134208 20646346 148920 148529
Stage evalpmc : 0.002 23445504 20703291 148920 148724
x3:
say(1);
say(2);
say(3);
Stage start : 0.000 7294976 5887811 41820 41508
Stage parse : 0.052 21729280 19263668 143310 142902
Stage past : 0.000 21745664 19276158 143310 142965
Stage post : 0.004 23162880 20624966 149430 149189
Stage pir : 0.001 23932928 21153098 151980 151600
Stage evalpmc : 0.002 23986176 21210183 151980 151795
x4:
say(1);
say(2);
say(3);
say(4);
Stage start : 0.000 7294976 5887843 41820 41508
Stage parse : 0.053 22183936 19701032 145860 145650
Stage past : 0.000 22200320 19713522 145860 145713
Stage post : 0.004 23674880 21116867 152490 152189
Stage pir : 0.001 24453120 21659123 155040 154671
Stage evalpmc : 0.002 24510464 21716348 155040 154866
pmichaud@kiwi:~/p6/nqp$
Apparent result: each say(n); statement requires ~2700 active PMCs and ~400KB of memory for parse+past.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment