From f84a67f29cfafa8844ccf904e97770847fb50d8d Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Tue, 25 Jan 2022 14:57:17 -0800 Subject: [PATCH] Don't trace bindSourceFile cache hits (#47602) Writing the trace entry takes longer than returning the cached value. Fixes #47565 --- src/compiler/binder.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 73e8bef6428..1f36ffff644 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -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 { @@ -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();