]> Cypherpunks repositories - gostls13.git/commit
all: use go/parser.SkipObjectResolution in more places
authorDaniel Martí <mvdan@mvdan.cc>
Thu, 21 Apr 2022 13:17:40 +0000 (14:17 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Tue, 23 Aug 2022 18:54:32 +0000 (18:54 +0000)
commitef22285f31ab16ff6751418705b8a7df8e0d661f
tree110375ac9fc1d9f9bcb21e1dbbc3da0ccef96eb2
parent7f632f76db65f28038b8797fbfe5e15a9f63e387
all: use go/parser.SkipObjectResolution in more places

None of cgo, "go test", nor srcimporter make use of go/ast's object
resolution via go/ast.Object. As such, we can skip that work during
parse time, which should save some CPU time.

We don't have any benchmark numbers, as none of the three packages have
any usable benchmarks, but we measured gofmt to be about 5% faster
thanks to this tweak in https://go.dev/cl/401454.
These three packages are quite different to gofmt, but one can expect
similar speed-ups in the 1-5% range.

Two notable exceptions, which do make use of go/ast.Object, are cmd/fix
and cmd/doc - we do not modify those here.

See #46485.

Change-Id: Ie3e65600d4790641c4e4d6f1c379be477fa02cee
Reviewed-on: https://go-review.googlesource.com/c/go/+/401455
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/cmd/cgo/ast.go
src/cmd/go/internal/load/test.go
src/go/internal/srcimporter/srcimporter.go