Go 1.19, an update of the Google-developed programming language due in August introduces a revised memory model and new types that make it easier to use atomic values.
Now in a preview stage, Go 1.19 can be downloaded from go.dev. The release is still considered unstable at this point.
sync/atomic package that make it easier to use atomic values such as atomic.int64 and atomic.Pointer(T).
The Go memory model specifies conditions under which reads of a variable in one goroutine can be guaranteed to observe values produced by writes to the same variable in a different goroutine. Go only provides sequentially consistent atomics, not any of the more relaxed forms offered in other languages.
Other new features and improvements in Go 1.19:
- The runtime now includes support for a soft memory limit. The limit includes the Go heap and other memory managed by the runtime and excludes external memory sources such as mappings of the binary, memory managed in other languages, and memory held by the OS on behalf of the Go program. Also, the runtime now schedules fewer GC worker routines on idle OS threads when the application is idle enough to force a periodic GC cycle.
- The compiler now uses a jump table to implement large integer and string switch statements. Performance improvements for the switch statement vary but can be on the order of 20% faster.
- The release supports links, lists, and clearer headings in doc comments.
- The build constraint,
unix, is now recognized in
- Support is added for the Loongson 64-bit architecture LoongArch on Linux.