Last active
August 16, 2023 08:56
-
-
Save ryogrid/e61ab3689267ce6ccb407d73e9a7bcbb to your computer and use it in GitHub Desktop.
go compiler coparison: gc go1.20.7 linux/amd64 vs gccgo (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NOTE: linux environment is WSL1 on Windows10 | |
ryo@DESKTOP-IOASPN6:/mnt/c/Data/work/go-bench$ uname -a | |
Linux DESKTOP-IOASPN6 4.4.0-19041-Microsoft #1237-Microsoft Sat Sep 11 14:32:00 PST 2021 x86_64 x86_64 x86_64 GNU/Linux | |
ryo@DESKTOP-IOASPN6:/mnt/c/Data/work/go-bench$ go version | |
go version go1.20.7 linux/amd64 | |
ryo@DESKTOP-IOASPN6:/mnt/c/Data/work/go-bench$ gccgo --version | |
gccgo (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.0 | |
Copyright (C) 2020 Free Software Foundation, Inc. | |
This is free software; see the source for copying conditions. There is NO | |
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
benchmark code: n-body | |
https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/nbody-go-3.html | |
// build binary with gc | |
ryo@DESKTOP-IOASPN6:/mnt/c/Data/work/go-bench$ go build -o nbody.go.gc.out nbody.go | |
// execute n-body bench | |
ryo@DESKTOP-IOASPN6:/mnt/c/Data/work/go-bench$ time ./nbody.go.gc.out 50000000 | |
-0.169075164 | |
-0.169059907 | |
real 0m4.338s | |
user 0m4.328s | |
sys 0m0.000s | |
// build binary with gccgo | |
ryo@DESKTOP-IOASPN6:/mnt/c/Data/work/go-bench$ gccgo -c nbody.go -O5 | |
ryo@DESKTOP-IOASPN6:/mnt/c/Data/work/go-bench$ gccgo -o nbody.go.gccgo.out nbody.o -Wl,-R,/lib/gcc/x86_64-linux-gnu/11 -static | |
// execute n-body bench | |
ryo@DESKTOP-IOASPN6:/mnt/c/Data/work/go-bench$ time ./nbody.go.gccgo.out 50000000 | |
-0.169075164 | |
-0.169059907 | |
real 0m5.248s | |
user 0m5.250s | |
sys 0m0.000s | |
the binary gccgo compiled is slower... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment