Skip to content

Commit

Permalink
internal/gopathwalk: walk directories concurrently
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Robert Findley <[email protected]>
Reviewed-by: Alan Donovan <[email protected]>
Auto-Submit: Bryan Mills <[email protected]>
  • Loading branch information
Bryan C. Mills authored and gopherbot committed Feb 6, 2024
1 parent 8fcb5f0 commit 4f6024e
Show file tree
Hide file tree
Showing 2 changed files with 161 additions and 153 deletions.
Loading

0 comments on commit 4f6024e

Please sign in to comment.