Member-only story
🧑🚀 Go 1.24 Swiss Tables Contribute To 2% CPU Usage Drop

Generic alias types, Swiss tables and new quantum safe key exchange mechanism came to life with Go 1.24
Lately I didn’t write too often about updates in our beloved Go language and it’s because I’m for in a search for new job, specifically Angular, or Vue related frontend developer role. So most of the time I’m spending sending resumes and participating in interviews.
But today I found some time to let you know what’s new in Go language. On 11th February version 1.24 was released. It seems like nothing out of ordinary, the language chosen by Typescript developers just had a minor release. But there are some interesting things.
Generic Type Aliases
Go 1.24 comes with full support for generic type aliases. So this is perfectly legal:
type set[P comparable] = map[P]bool
2% CPU Usage Drop With Swiss Tables And More
There are several performance improvements and the most notable one revolves around built in map. It was rewritten to use Swiss Tables.
The way they work is quite interesting. Normally a hashtable is like an array where the key is a hash, and value is stored under the hash position in the array.
So when you want to retrieve the value, you just hash key and retrieve value from under the hash position.
The problem of performance of a hash tables lies in the fact that when two keys generate the same hash, a more consuming routine has to be taken to store both values properly. What brings performance down especially when collisions occurs often.
Swiss tables take an interesting approach to lower the impact of collisions on performance.
They store additional metadata for items. They store one bit indicating if the value is slot is empty or deleted, and expanded hash. That way all algorithms can be optimised and provide a performance gain. Especially because SIMD operations can be performed to retrieve data faster.