Open
Description
Go version
go version go1.24.1 windows/amd64
Output of go env
in your module/workspace:
set AR=ar
set CC=gcc
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_ENABLED=1
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set CXX=g++
set GCCGO=gccgo
set GO111MODULE=
set GOAMD64=v1
set GOARCH=amd64
set GOAUTH=netrc
set GOBIN=
set GOCACHE=C:\Users\jabaile\AppData\Local\go-build
set GOCACHEPROG=
set GODEBUG=
set GOENV=C:\Users\jabaile\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFIPS140=off
set GOFLAGS=
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\jabaile\AppData\Local\Temp\go-build3919903901=/tmp/go-build -gno-record-gcc-switches
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMOD=D:\work\TypeScript-go\go.mod
set GOMODCACHE=C:\Users\jabaile\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\jabaile\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Users\jabaile\scoop\apps\go\current
set GOSUMDB=sum.golang.org
set GOTELEMETRY=local
set GOTELEMETRYDIR=C:\Users\jabaile\AppData\Roaming\go\telemetry
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Users\jabaile\scoop\apps\go\current\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.24.1
set GOWORK=
set PKG_CONFIG=pkg-config
What did you do?
These tests come from the Go port of The TypeScript compiler. We've found that on Windows only, the Go test cache seems to make things a lot slower (microsoft/typescript-go#685 disables it for Windows for now).
$ git clone --recurse-submodules https://github.com/microsoft/typescript-go.git
$ cd typescript-go
# warm the caches
$ go test ./internal/testrunner
# clean the test cache only
$ go clean -testcache
$ Measure-Command { go test ./internal/testrunner | Out-Default }
$ Measure-Command { go test -count=1 ./internal/testrunner | Out-Default }
What did you see happen?
On my machine, the test run after cleaning the test cache takes 13 to run the tests, but the wall time is 65 seconds:
$ Measure-Command { go test ./internal/testrunner | Out-Default }
ok github.com/microsoft/typescript-go/internal/testrunner 13.584s
Days : 0
Hours : 0
Minutes : 1
Seconds : 5
Milliseconds : 364
Ticks : 653649277
TotalDays : 0.000756538515046296
TotalHours : 0.0181569243611111
TotalMinutes : 1.08941546166667
TotalSeconds : 65.3649277
TotalMilliseconds : 65364.9277
What did you expect to see?
Tunning with -count=1
(skipping all test caching), the actual test time is about the same, but the wall time is only 15 seconds, about 4-5x faster:
$ Measure-Command { go test -count=1 ./internal/testrunner | Out-Default }
ok github.com/microsoft/typescript-go/internal/testrunner 11.726s
Days : 0
Hours : 0
Minutes : 0
Seconds : 15
Milliseconds : 296
Ticks : 152960956
TotalDays : 0.000177038143518519
TotalHours : 0.00424891544444444
TotalMinutes : 0.254934926666667
TotalSeconds : 15.2960956
TotalMilliseconds : 15296.0956
This doesn't reproduce on Linux.
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
seankhliao commentedon Mar 21, 2025
maybe #35801
gabyhelp commentedon Mar 21, 2025
Related Issues
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
jakebailey commentedon Mar 21, 2025
#26562, #61608 above are related too, but unlike the past closed issues I actually have a repro 😄
prattmic commentedon Mar 22, 2025
cc @matloob @samthanawalla
prattmic commentedon Mar 22, 2025
Odd, I can't clone the repo at all on Windows:
jakebailey commentedon Mar 22, 2025
Your git install may not have long paths enabled; the Windows GUI installer I think preselects the option but some installs might not.
(Apologies for the terribly long test names; they're autogenerated and used to "fit" before we started using the repo as a submodule...)
prattmic commentedon Mar 22, 2025
Thanks, I'll give that a try.
FWIW, I can reproduce this on Linux, but the delta is less extreme at ~2x:
24s vs 12s
jakebailey commentedon Mar 22, 2025
Oh, wow, I guess my internal clock never noticed.
Not quite as pronounced on my machine but I guess I couldn't tell 9 seconds from 14 seconds.
prattmic commentedon Mar 22, 2025
I managed to reproduce on a gotip-windows-amd64 gomote by setting
git config --global core.longpaths true
first.There I get 110s vs 16s.
prattmic commentedon Mar 22, 2025
Back to Linux, looking at system calls via strace.
Here are the syscall counts with
-count=1
:And with caching:
The caching version makes 10x as many newfstatat calls.
My guess would be that FS calls are more expensive on Windows, making the issue more pronounced.
33 remaining items