Go 1.21 released the first RC: The official version will be launched before August
Go 1.21 released the first RC: The official version will be launched before August
Go 1.21 released the first RC: The official version will be launched before August.
The first RC for Go 1.21 has been released.
Although this is the first RC for Go 1.21, its version number is
go1.21rc2. Because the development team found a bug after tagging RC1, they immediately fixed it and released an update based on that version.
Go 1.21 Major Changes
Improved toolchain
- The Profile Guided Optimization (PGO) feature is officially GA .
The Enable Profile Guided Optimization (PGO) feature that was in preview in 1.20 is now officially GA. If a file named exists in the main package directory default.pgo, gothe command will use it to enable PGO builds.
Profile-guided optimization (PGO) is a compiler optimization technique in computer programming, which translates to optimization guided by configuration files.
PGO is also known as:
Profile-directed feedback (PDF)
Feedback-directed optimization (FDO)
Its principle is that the compiler uses the runtime profiling information of the program to generate higher-quality code, thereby improving the performance of the program.
As a general compiler optimization technique, PGO is not limited to a certain language. For example, the Rust compiler is also exploring the use of PGO , and Microsoft uses LTO+PGO to optimize the Linux kernel .
In Go, the original proposal for PGO proposed adding support for Profile-Guided Optimization (PGO) to the Go GC toolchain, so that the toolchain could perform application- and workload-specific optimizations based on runtime information.
The Go development team tested the impact of PGO on various Go programs and found performance improvements of 2-7% .
Related news on Nov 2020
Rust Compiler Exploration Using PGO
The Rust Compiler Team presented the practice of applying PGO to the Rust compiler (rustc). They said the move was largely inspired by Mozilla, a heavy Rust user who has been using Profile-Guided Optimization (PGO) for the past few months to build its own optimized version of Clang , and Reduced Firefox compile times by 9% using this build infrastructure.
So the Rust compilation team wonders if it’s possible to apply PGO to rustc itself to improve speed?
The conclusion is that PGO can significantly reduce compilation times, but making these improvements available to consumers is not as simple as adding a compiler flag to dist builds . PGO differs from most other optimizations in that:
More instrumentation and data collection stages, thus requiring a different extension build workflow
Incurs an ongoing build time cost, a feature common to automated optimizations such as LTO
The above two problems have greatly hindered the application of PGO on the compiler. Rust’s CI build time is relatively long, and the team has given up some optimizations (for example, due to the slow speed of the build machine on the Mac platform, macOS still cannot pass 10% performance improvement with ThinLTOed LLVM).
For the above two obstacles, the Rust compiler team proposed a trade-off proposal. One is to let the computer spend a few more hours on the build, which can reduce the compilation time by 15% in the next few months; Significant engineering costs have been invested in the build setup of , such as introducing out-of-band instrumentation and providing caching of profile data.
