diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-09-26 22:03:31 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-09-26 22:03:31 -0700 |
commit | 7a840e573cdc0abbca3c1dbf639797082b5124c8 (patch) | |
tree | cdda28728751a909223b9e8545360c2c9f42ae25 | |
parent | 9dae0267e8a9ac0c28c10247aa46211d84f7e18f (diff) |
intertyper profiler
-rw-r--r-- | src/compiler.js | 2 | ||||
-rw-r--r-- | src/intertyper.js | 13 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/compiler.js b/src/compiler.js index 77abd53b..94197390 100644 --- a/src/compiler.js +++ b/src/compiler.js @@ -274,6 +274,8 @@ function compile(raw) { intertyped = null; JSify(analyzed); + //dumpInterProf(); + phase = null; if (DEBUG_MEMORY) { diff --git a/src/intertyper.js b/src/intertyper.js index e43cc298..525096f5 100644 --- a/src/intertyper.js +++ b/src/intertyper.js @@ -987,8 +987,14 @@ function intertyper(lines, sidePass, baseLineNums) { // Input lineSplitter().forEach(function(line) { + //var time = Date.now(); + var t = tokenizer(line); var item = triager(t); + + //var type = item ? item.intertype + (item.op ? ':' + item.op : ''): 'none'; + //interProf[type] = (interProf[type] || 0) + Date.now() - time; + if (!item) return; finalResults.push(item); if (item.tokens) item.tokens = null; // We do not need tokens, past the intertyper. Clean them up as soon as possible here. @@ -996,3 +1002,10 @@ function intertyper(lines, sidePass, baseLineNums) { return finalResults; } +/* +var interProf = {}; +function dumpInterProf() { + printErr('\nintertyper/' + phase + ' : ' + JSON.stringify(keys(interProf).sort(function(x, y) { return interProf[y] - interProf[x] }).map(function(x) { return x + ':' + interProf[x] }), null, ' ') + '\n'); +} +*/ + |