-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Description
What version of Go are you using (go version)?
1.10.3
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (go env)?
linux; amd64
What did you do?
go test --count 1 .; time go test .
foo_test.go:
// package and imports snipped
func TestCache(t testing.T) {
tmp := os.TempDir()
for i := 0; i < 101000*1000; i++ {
os.Stat(filepath.Join(tmp, fmt.Sprintf("%d", i)))
}
}
What did you expect to see?
$ go test --count 1 .; time go test .
ok github.com/dbentley/testcache 11.839s
ok github.com/dbentley/testcache (cached)
real 2s
What did you see instead?
$ go test --count 1 .; time go test .
ok github.com/dbentley/testcache 11.839s
ok github.com/dbentley/testcache (cached)
real 1m2.278s
Further investigation
Using GODEBUG=gocachetest=1 or GODEBUG=gocachehash=1 doesn't cause output for 30+s.
I think the function inDir (currently at https://github.com/golang/go/blob/master/src/cmd/go/internal/test/test.go#L1450 ) evaluates symlinks, which requires lots of stat'ing.
It looks like this was introduced in 37d5627
Metadata
Metadata
Assignees
Labels
Type
Projects
Status