Go 1.14 focuses on runtime, compiler

[ad_1]

Go 1.14, the next version of the Google-developed open source programming language used to create Docker, Kubernetes, Istio, and other cloud-native computing projects, is now in a beta stage and expected as a production release in February.

The forthcoming Go upgrade improves the runtime and compiler. Version 1.14 also will be the last to support 32-bit Apple platforms, according to release notes.

With the Go runtime improvements, the performance of most use cases of defer has been boosted to incur nearly no overhead, compared to calling the deferred function directly. As a result, defer now can be used in performance-critical code without overhead concerns.

The improved Go runtime also makes goroutines asynchronously pre-emptible. This means loops without function calls no longer potentially deadlock the scheduler or significantly delay garbage collection. This capability is supported on all platforms except windows/arm, darwin/arm, js/wasm, and plan9/*.

One consequence of the pre-emption implementation is that Go 1.14 programs on Linux and MacOS will receive more signals than earlier versions. Programs using packages such as syscall or golang.org/x/sys/unix will see more slow system calls fail with EINTR errors. These programs will have to handle those errors in some way, most likely by looping to try the system call again.

In addition, the page allocator is more efficient and incurs less lock contention at high values of GOMAXPROCS. This will be most noticeable as lower latency and higher throughput for large allocations done in parallel and at a high rate.

The Go compiler, meanwhile, adds -d=checkptr as a a compile-time option for checking that Go code is abiding by unsafe.Pointer safety rules dynamically. Also, the compiler now can emit machine-readable logs of key optimizations using the -json flag, including inlining and bounds-check elimination. Detailed escape analysis diagnostics now work again, and experimental support is offered for compiler-inserted coverage instrumentation for fuzzing.

Other changes and improvements in Go 1.14 include:

  • In an improvement to Go’s WebAssembly support, JavaScript values referenced from Go via js.Value objects now can be garbage-collected. However, js.Value objects no longer can be compared using the == operator. They must instead be compared using the Equal method. Also, js.Value now has IsUndefined, IsNull, and IsNaN methods. 
  • Similar to what is happening with the Rust language, the Go 1.14 release will be the last to support 32-bit binaries on MacOS. It will likely also be the last to support 32-bit binaries on other Apple platforms including iOS, iPadOS, WatchOS, and tvOS.
  • In a language change, embedding of overlapping interfaces is now permitted.
  • Support is discontinued for the Google Native Client platform
  • The 64-bit architecture of FreeBSD is now supported.
  • The go command now supports Subversion repos in module mode. This command also now has snippets of plain-text error messages from module proxies and other HTTP servers. An error message is shown only if it is valid UTF-8 and has only graphic characters and spaces.
  • Binaries on Windows have Data Execution Prevention (DEP) enabled for system-level memory protection.
  • A new flag, -modfile=file, instructs the go command to read and possibly write an alternative go.mod file rather than the one in the module root directory.
  • The go get command no longer accepts the -mod flag.

Go 1.14 can be downloaded from golang.org. 

This story, “Go 1.14 focuses on runtime, compiler” was originally published by

InfoWorld.

Share this post if you enjoyed! 🙂

[ad_2]

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *