tools/internal/gopathwalk
Bryan C. Mills 4f6024ea39 internal/gopathwalk: walk directories concurrently
This restores the concurrent walking that was removed in CL 508506,
since that concurrency turns out to actually matter in practice
(see golang/go#44863), but uses a different (and in my opinion simpler)
concurrency pattern based on the one shown in my 2018 GopherCon talk
(https://drive.google.com/file/d/1nPdvhB0PutEJzdCq5ms6UI58dp50fcAN/view,
slide 114), and removes the arbitrary 4-goroutine minimum.

On my machine this speeds up the benchmark from CL 561436
by a factor of around 3½.

	goos: linux
	goarch: amd64
	pkg: golang.org/x/tools/internal/imports
	cpu: Intel(R) Xeon(R) CPU @ 2.20GHz
	                              │  before.txt  │              after.txt              │
	                              │    sec/op    │   sec/op     vs base                │
	ModuleResolver_InitialScan-24   1728.0m ± 5%   505.2m ± 7%  -70.76% (p=0.000 n=10)

Fixes golang/go#65531.
Updates golang/go#44863.

Change-Id: I082bb3375f7775d55d130bf75ae71f53312aace1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/561675
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
2024-02-06 18:40:19 +00:00
..
walk.go internal/gopathwalk: walk directories concurrently 2024-02-06 18:40:19 +00:00
walk_test.go internal/gopathwalk: walk directories concurrently 2024-02-06 18:40:19 +00:00