Skip to content

Commit

Permalink
Print per-file transformation times to stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
amcasey committed Aug 11, 2020
1 parent 57e2fe0 commit 70b5fb8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/compiler/transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,16 @@ namespace ts {
state = TransformationState.Initialized;

// Transform each node.
const transformed = map(nodes, allowDtsFiles ? transformation : transformRoot);
const transformed: T[] = [];
for (const node of nodes) {
const start = timestamp();
transformed.push((allowDtsFiles ? transformation : transformRoot)(node));
const end = timestamp();
const path = (node as any as SourceFile).path;
if (path) {
console.error(`Transformed ${path} in ${end - start}ms`);
}
}

// prevent modification of the lexical environment.
state = TransformationState.Completed;
Expand Down

0 comments on commit 70b5fb8

Please sign in to comment.