The Go Compiler Needs to be Smarter

https://lemire.me/blog/2020/06/04/the-go-compiler-needs-to-be-smarter/

I gave a talk on Go last year and I was asked for a criticism of Go. I do not mind that Go lacks exceptions or generics. These features are often overrated.

Strongly disagree about generics!

In practice, it means that if you want good performance in Go, you often have to manually inline your functions. And I mean: fully inline. You have to write a really explicit function if you want the Go compiler to optimize the computation away

Go’s saving grace is that it makes it easy to integrate assembly code into your code base. So you can write your performance-critical in C, compile it, and use the result in your Go project.

This is all a bit surprising, especially given that Go is now Google’s primary language. It almost seems like Go’s whole aesthetic of being as boring/predictable as possible extends to the level of compiler optimizations.

Edit