go build at most 37x slower in 1.21.5 vs 1.19.3

192 views
Skip to first unread message

Lib Martinito

unread,
Dec 13, 2023, 10:40:21 AM12/13/23
to golang-nuts

Screenshot 2023-12-13 at 8.05.38 PM.pngScreenshot 2023-12-13 at 8.13.47 PM.png

It's 37x slower on go 1.21.5 to build the first time. Do anyone of you know why that is? Should I raise a bug instead?

What I compiled was only a simple "hello world!" using println. The environments are docker images - go-1.19:alpine and go-1.21:alpine respectively.

It would be appreciated if anyone could shed some light around this. 

TheDiveO

unread,
Dec 13, 2023, 11:55:49 AM12/13/23
to golang-nuts
IIRC the stdlib isn't delivered precompiled anymore since 1.20. You should make sure to have layer caching in place in case you want to tune your pipelines. You can do a "go build std" IIRC.

Steven Hartland

unread,
Dec 13, 2023, 11:59:08 AM12/13/23
to Lib Martinito, golang-nuts
If I recall correctly 1.21 stopped shipping precompiled libs so would need to compile all the standard libs which previously it didnt have to do.

Can anyone confirm?

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/95c815d8-5d72-4f85-a484-9199de5cff23n%40googlegroups.com.

Def Ceb

unread,
Dec 13, 2023, 12:01:51 PM12/13/23
to golan...@googlegroups.com
The Go blog does indeed say this.
> The go tool no longer relies on pre-compiled standard library package
archives in the $GOROOT/pkg directory, and they are no longer shipped
with the distribution, resulting in smaller downloads. Instead, packages
in the standard library are built as needed and cached in the build
cache, like other packages.

https://go.dev/blog/go1.20

Steven Hartland:
> If I recall correctly 1.21 stopped shipping precompiled libs so would
> need to compile all the standard libs which previously it didnt have to do.
>
> Can anyone confirm?
>
> On Wed, 13 Dec 2023 at 15:40, Lib Martinito <l...@codecrafters.io
> <mailto:l...@codecrafters.io>> wrote:
>
>
> Screenshot 2023-12-13 at 8.05.38 PM.pngScreenshot 2023-12-13 at
> 8.13.47 PM.png
>
> It's 37x slower on go 1.21.5 to build the first time. Do anyone of
> you know why that is? Should I raise a bug instead?
>
> What I compiled was only a simple "hello world!" using println. The
> environments are docker images - go-1.19:alpine and go-1.21:alpine
> respectively.
>
> It would be appreciated if anyone could shed some light around this.
>
> --
> 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...@googlegroups.com
> <mailto:golang-nuts...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/95c815d8-5d72-4f85-a484-9199de5cff23n%40googlegroups.com <https://groups.google.com/d/msgid/golang-nuts/95c815d8-5d72-4f85-a484-9199de5cff23n%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> --
> 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...@googlegroups.com
> <mailto:golang-nuts...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/CAA38peZcU%3DxSGpRHNEDrfpNHV0jho9Bg7Y13vz9TSMfZS4rGPw%40mail.gmail.com <https://groups.google.com/d/msgid/golang-nuts/CAA38peZcU%3DxSGpRHNEDrfpNHV0jho9Bg7Y13vz9TSMfZS4rGPw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages