Go 1.20 Introduces Preview for Profile-Guided Optimization and Language Enhancements
Go 1.20, the latest update of the Google-developed open source language, includes a preview for profile-guided optimization (PGO) and language improvements. PGO improves performance by 3% to 4% with inlining optimization, while other optimizations are in the pipeline.

Go 1.20, the production release of the Google-created open-source language celebrated for its simplicity, concurrency, and functional programming features, has been introduced, with a preview of profile-guided optimization (PGO) for the compiler. Go 1.20 can be downloaded from the official go.dev website.
With the preview of PGO in Go 1.20, the compiler toolchain can carry out application and workload-specific optimizations depending on runtime profile information. The current compiler supports pprof CPU profiles, which can be gathered using the runtime/pprof or net/http/pprof packages.
Also known as feedback-directed optimization, PGO involves feeding profile data from representative runs of the application back into the compiler for the next build of the application. By using this information, the compiler can make more informed optimization decisions. Benchmarks for a representative set of Go programs show that enabling PGO inlining optimization boosts performance by around 3% to 4%. Future releases are expected to introduce more PGO optimizations.
Along with the introduction of PGO, Go 1.20 also brings four changes to the language. Firstly, the ability to convert a slice to an array pointer, introduced in 2021's Go 1.17, now extends to conversions from a slice to an array. Secondly, the unsafe package includes three new functions: SliceData, String, and StringData. These functions offer the complete capability to construct and deconstruct slice and string values, regardless of their exact representation.
Thirdly, the specification now establishes that struct values are compared one field at a time, taking into account fields in the order they appear in the struct type definition, and stopping at the first mismatch. Fourthly, comparable types such as ordinary interfaces can satisfy comparable constraints, even if the type arguments are not strictly comparable. This enables the instantiation of a type parameter constrained by comparable constraints with a non-strictly comparable type argument, like an interface type or a composite type that contains an interface type.
In addition to these language changes, Go 1.20 comes with various other enhancements, such as supporting code coverage profiles collection for programs, including applications and integration tests. The directory $GOROOT/pkg no longer keeps precompiled package activities for the standard library, which reduces the Go distribution size and avoids C toolchain skew for cgo packages. Moreover, the implementation of go test –json has been fortified to increase robustness, while the go version -m command now reads a wider range of Go binaries, including Windows DLLs and Linux binaries without execute permission.
Go 1.20 also brings experimental support for FreeBSD on RISC-V and disables cgo by default on systems without a C toolchain. However, Go 1.20 will be the last release to support macOS 10.13 High Sierra and 10.14 Mojave, with Go 1.21 requiring macOS 10.15 Catalina or later.
No-code platform like AppMaster.io can greatly benefit from incorporating newly optimized languages like Go 1.20. By integrating such powerful tools for web, mobile, and backend applications, businesses can achieve significant improvements in productivity, user experience, and scalability. Learn more about no-code and low-code app development to stay ahead of the technology curve.


