On Wed, Oct 2, 2024 at 11:53 AM opennota <openn...@gmail.com> wrote:
>
> I'm seeing lots of GOCACHE accesses, but there's a considerable delay after 
> `go build -x -toolexec time` prints `WORK=/tmp/go-build329465119` and before 
> it starts to print all the other commands/package names/times.

Hmmm, OK, then maybe you do need to profile cmd/go.  I don't think
there is any trivial way to do that.  You could do it by editing
cmd/go/main.go to create a CPU profile (see
runtime/pprof.StartCPUProfile), but as far as I know that code isn't
already there.

Most likely your module graph is very large, but tens of minutes is an
unreasonable length of time.  How long are your go.mod and go.sum
files?  Have you run "go mod tidy"?

Ian



> On Thursday 3 October 2024 at 00:21:30 UTC+7 Ian Lance Taylor wrote:
>>
>> On Wed, Oct 2, 2024 at 10:11 AM opennota <open...@gmail.com> wrote:
>> >
>> > Cold-start builds are slow af on my machine (think tens of minutes), and 
>> > have been like that since around Go 1.20. (See also maybe related 
>> > https://github.com/golang/go/issues/38939). Is there a way to profile `go 
>> > build` to determine why it takes it so long to build even a simple 
>> > hello-world program?
>>
>> In some cases you can get an initial look by running "go build -x
>> -toolexec time PROG". Although the output is a bit cluttered, that
>> will show you the commands being executed and how long they take to
>> run. Perhaps that will suggest something.
>>
>> Ian
>
> --
> 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/e30076ba-a442-4faa-a87c-40dab866c388n%40googlegroups.com.

-- 
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/CAOyqgcUQsCt00_AQRnXc%3DfvyZKYXMb1ymEKGg0wBK0PfQTgQjw%40mail.gmail.com.

Reply via email to