From d5076cc64d484da83963b1ae098aef830c21c448 Mon Sep 17 00:00:00 2001 From: Rob Findley Date: Mon, 3 Apr 2023 22:06:04 -0400 Subject: [PATCH] gopls/internal/lsp/cache: don't trace a region for MetadataForFile In the common case, MetadataForFile is just a map lookup. Benchmarks demonstrate that capturing a trace region is too expensive. Change-Id: I02d2b65de88f5db37beb16fba034e3c49c5f6096 Reviewed-on: https://go-review.googlesource.com/c/tools/+/481785 TryBot-Result: Gopher Robot Reviewed-by: Alan Donovan Run-TryBot: Robert Findley gopls-CI: kokoro --- gopls/internal/lsp/cache/snapshot.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/gopls/internal/lsp/cache/snapshot.go b/gopls/internal/lsp/cache/snapshot.go index 5e63ed94a76..d0837f51ab7 100644 --- a/gopls/internal/lsp/cache/snapshot.go +++ b/gopls/internal/lsp/cache/snapshot.go @@ -740,9 +740,6 @@ func (s *snapshot) MethodSets(ctx context.Context, ids ...PackageID) ([]*methods } func (s *snapshot) MetadataForFile(ctx context.Context, uri span.URI) ([]*source.Metadata, error) { - ctx, done := event.Start(ctx, "cache.snapshot.MetadataForFile") - defer done() - s.mu.Lock() // Start with the set of package associations derived from the last load.