From 608e9fac9055aa188c513f4dd53f12e692bc3c0c Mon Sep 17 00:00:00 2001 From: Mark Freeman Date: Wed, 28 May 2025 12:12:35 -0400 Subject: [PATCH] go/types, types2: flip on position tracing MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Running compilebench with flags off / on, we get the below: │ old.txt │ new.txt │ │ sec/op │ sec/op vs base │ Template 149.2m ± 6% 155.5m ± 5% ~ (p=0.280 n=10) Unicode 110.1m ± 3% 105.8m ± 7% ~ (p=0.280 n=10) GoTypes 774.0m ± 6% 757.7m ± 2% ~ (p=0.247 n=10) Compiler 109.6m ± 6% 109.8m ± 6% ~ (p=0.579 n=10) SSA 4.562 ± 2% 4.550 ± 2% ~ (p=0.436 n=10) Flate 101.65m ± 9% 96.32m ± 7% -5.24% (p=0.043 n=10) GoParser 168.7m ± 6% 173.7m ± 6% ~ (p=0.436 n=10) Reflect 390.2m ± 5% 387.8m ± 6% ~ (p=0.684 n=10) Tar 185.9m ± 3% 182.2m ± 4% ~ (p=0.529 n=10) XML 212.7m ± 4% 211.4m ± 4% ~ (p=0.971 n=10) LinkCompiler 490.9m ± 4% 480.4m ± 4% ~ (p=0.353 n=10) ExternalLinkCompiler 1.501 ± 1% 1.501 ± 1% ~ (p=0.853 n=10) LinkWithoutDebugCompiler 311.8m ± 4% 308.6m ± 4% ~ (p=0.579 n=10) StdCmd 17.60 ± 1% 17.62 ± 1% ~ (p=0.912 n=10) geomean 427.5m 424.2m -0.77% Overall, we do not see a statistically significant perforance impact. Flate actually reports a speedup, but with a p-value of 0.043, it's quite close to the significance threshold (which is fairly lenient). In my opinion, this is likely due to chance. Fixes #51603 Change-Id: I7f439730be45e02c7f799df768590ef78e321952 Reviewed-on: https://go-review.googlesource.com/c/go/+/676816 Reviewed-by: Robert Griesemer LUCI-TryBot-Result: Go LUCI --- src/cmd/compile/internal/types2/check.go | 2 +- src/go/types/check.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cmd/compile/internal/types2/check.go b/src/cmd/compile/internal/types2/check.go index 31a1aa2abe..411a1719ce 100644 --- a/src/cmd/compile/internal/types2/check.go +++ b/src/cmd/compile/internal/types2/check.go @@ -22,7 +22,7 @@ var nopos syntax.Pos const debug = false // leave on during development // position tracing for panics during type checking -const tracePos = false // TODO(markfreeman): check performance implications +const tracePos = true // _aliasAny changes the behavior of [Scope.Lookup] for "any" in the // [Universe] scope. diff --git a/src/go/types/check.go b/src/go/types/check.go index e4e8e95c99..c9753280bf 100644 --- a/src/go/types/check.go +++ b/src/go/types/check.go @@ -25,7 +25,7 @@ var noposn = atPos(nopos) const debug = false // leave on during development // position tracing for panics during type checking -const tracePos = false // TODO(markfreeman): check performance implications +const tracePos = true // gotypesalias controls the use of Alias types. // As of Apr 16 2024 they are used by default. -- 2.51.0