Home > Backend Development > Golang > Why is golang compilation fast?

Why is golang compilation fast?

(*-*)浩
Release: 2019-12-14 13:11:59
Original
3532 people have browsed it

Why is golang compilation fast?

If you want to run a tool written in go on your home router (R6300v2), you need to build a go cross-compiler for host x64 and target arm. It took a few minutes to read the official document, and the result was as simple as: (Recommended learning: Go )

$ git clone .../go && cd go && git checkout go1.4.2
$ cd src
$ GOOS=linux GOARCH=arm GOARM=5 ./make.bash
Copy after login

According to my previous cross compile GCC Toolchain's experience, compile It takes anywhere from a few minutes to more than ten minutes. The result is that on my E3 1230v3 256G Plextor M6S, compiling go (including libraries) took less than 20 seconds, maybe less than 10 seconds. Faster than git clone.

The Go compiler supports nine instruction sets. There are important differences in compiler quality across architectures.

amd64(也称为x86-64)
成熟的实现。
386(x86或x86-32)
与amd64端口相当。
arm(ARM)
支持Linux,FreeBSD,NetBSD,OpenBSD和Darwin二进制文件。没有其他端口广泛使用。
arm64(AArch64)
支持Linux和Darwin二进制文件。1.5中的新功能,没有其他端口那么好用。
ppc64, ppc64le (64位PowerPC大端和小端)
支持Linux二进制文件。1.5中的新功能,没有其他端口那么好用。
mips, mipsle (32位MIPS大端和小端)
支持Linux二进制文件。1.8中的新功能,没有其他端口那么好用。
mips64, mips64le (64位MIPS大端和小端)
支持Linux二进制文件。1.6中的新功能,没有其他端口那么好用。
s390x (IBM System z)
支持Linux二进制文件。1.7中的新功能,没有其他端口那么好用。
wasm (WebAssembly)
定位到WebAssembly平台。1.11中的新功能,没有其他端口那么好用。
Copy after login

Runtime support is the same for all ports except for things like the underlying operating system interface code, including a mark-and-sweep garbage collector, valid array and string slicing, and valid Support for goroutines (e.g. stack). Grow and shrink on demand.

The compiler can target DragonFly BSD, FreeBSD, Linux, NetBSD, OpenBSD, macOS (Darwin), Plan 9, Solaris and Windows operating systems.

The following additional constraints apply to systems that can only be built from source:

For Linux on 64-bit PowerPC, the minimum supported kernel version is 2.6.37, which Meaning Go does not support CentOS 6 on these systems.

The above is the detailed content of Why is golang compilation fast?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template