It can also be something to exclude the tmp directory in which Go compiles when you do a 'go run' (I assume you meant that when saying 'build and run')
What happens if you just build? - Is this slow what happens if you just execute? - Is this slow? What happens if you go install some-tool and run that? - is that slow? Op woensdag 14 december 2022 om 21:03:26 UTC+1 schreef thepud...@gmail.com: > Hi Declan, > > Virus scanners can slow things down significantly on Windows, including > virus scanners can go into overdrive if you are touching many files, > touching files with atypical extensions, or building and then immediately > executing a new binary. > > To start, you could try temporarily disabling your virus scanner and see > if it helps. > > If it does help, you might be able to benefit from finer grain changes. > Most virus scanners support exclusion lists if you have sufficient > privileges. You could try for example excluding (1) the directories with > your Go code, (2) the directory shown in 'go env GOCACHE', (3) possibly the > directory shown in 'go env GOMODCACHE', and possibly others. > > I would be curious to hear your results. > > Even if this is not the particular problem you hit, it is something other > gophers hit, and it would be nice to document this somewhere if it isn't > already. > > Separately, I thought that Rust for example would add some default > exclusions for Windows Defender, which could be an option for the Go > Windows installer. However, I'm not seeing that just now based on some > quick spot checking, so maybe that's something Rust only used to do, or > perhaps I am thinking of something else. > > Finally, especially if you are in a corporate environment, there can be > other security agents, network services, proxies, and other agents that can > interfere with development performance beyond virus scanners. > > Regards, > thepudds > > On Wednesday, December 14, 2022 at 12:57:40 PM UTC-5 Declan Finn wrote: > >> Hi, >> >> Platform: Windows 10 >> Go Version: 1.19.4 >> >> Compile and run of the most basic helloworld program is extremely slow on >> my windows machine, taking roughly 30 seconds every time. >> Whereas the exact same program, using the same go version, compiles and >> runs in under 1 second on my Ubuntu machine. >> Why is it so slow on windows? >> I asked a collogue to do the same test on his windows machine and he sees >> the same slowness. >> Any help would be greatly appreciated. >> >> >> -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/13d8ed63-2d9a-4852-9ac7-ce0c0215a553n%40googlegroups.com.