mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 21:36:50 -05:00
Re-do tracing initialization and tests around calls
Make `tracing` either `undefined` or the same namespace as before.
Switching all calls to `tracing?.___` means that there is no cost for
a call or the arguments when tracing is not used. Comparing two runs
without tracing (27 runs, drop 5+5, avg rest) I get:
master:
42.59s user 1.00s system 165% cpu 26.372 total
changed:
42.01s user 0.982 system 165% cpu 26.039 total
(Makes it all private, so no api changes.)
This commit is contained in:
@@ -501,7 +501,7 @@ namespace ts {
|
||||
updateSolutionBuilderHost(sys, cb, buildHost);
|
||||
const builder = createSolutionBuilder(buildHost, projects, buildOptions);
|
||||
const exitStatus = buildOptions.clean ? builder.clean() : builder.build();
|
||||
tracing.dumpLegend();
|
||||
tracing?.dumpLegend();
|
||||
return sys.exit(exitStatus);
|
||||
}
|
||||
|
||||
@@ -666,7 +666,8 @@ namespace ts {
|
||||
}
|
||||
|
||||
if (canTrace(system, compilerOptions)) {
|
||||
tracing.startTracing(isBuildMode ? tracing.Mode.Build : tracing.Mode.Project, compilerOptions.generateTrace!, compilerOptions.configFilePath);
|
||||
startTracing(isBuildMode ? tracingEnabled.Mode.Build : tracingEnabled.Mode.Project,
|
||||
compilerOptions.generateTrace!, compilerOptions.configFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -674,7 +675,7 @@ namespace ts {
|
||||
const compilerOptions = program.getCompilerOptions();
|
||||
|
||||
if (canTrace(sys, compilerOptions)) {
|
||||
tracing.stopTracing(program.getTypeCatalog());
|
||||
tracing?.stopTracing(program.getTypeCatalog());
|
||||
}
|
||||
|
||||
let statistics: Statistic[];
|
||||
|
||||
Reference in New Issue
Block a user