Skip to content

Commit

Permalink
Don't trace bindSourceFile cache hits (#47602)
Browse files Browse the repository at this point in the history
Writing the trace entry takes longer than returning the cached value.

Fixes #47565
  • Loading branch information
amcasey authored Jan 25, 2022
1 parent ba402e6 commit f84a67f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/compiler/binder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,12 @@ namespace ts {
const binder = createBinder();

export function bindSourceFile(file: SourceFile, options: CompilerOptions) {
tracing?.push(tracing.Phase.Bind, "bindSourceFile", { path: file.path }, /*separateBeginAndEnd*/ true);
performance.mark("beforeBind");
perfLogger.logStartBindFile("" + file.fileName);
binder(file, options);
perfLogger.logStopBindFile();
performance.mark("afterBind");
performance.measure("Bind", "beforeBind", "afterBind");
tracing?.pop();
}

function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
Expand Down Expand Up @@ -253,7 +251,9 @@ namespace ts {
Debug.attachFlowNodeDebugInfo(reportedUnreachableFlow);

if (!file.locals) {
tracing?.push(tracing.Phase.Bind, "bindSourceFile", { path: file.path }, /*separateBeginAndEnd*/ true);
bind(file);
tracing?.pop();
file.symbolCount = symbolCount;
file.classifiableNames = classifiableNames;
delayedBindJSDocTypedefTag();
Expand Down

0 comments on commit f84a67f

Please sign in to comment.