Photo by [Alain Gehri](https://unsplash.com/@alainpictures) on [Unsplash](https://unsplash.com/photos/ehNRo3eWJAk)

Improve your Go code with Benchmarks

We often write code without thinking about how performant the code will be in the end. Often it is also not worth to sacrifice cleaner code in terms of readability and future maintainability for the sake of a few percents of performance, be it less CPU cycles needed to compute something or a smaller memory footprint. But as always even if you don’t need to save a few cycles or bytes, it is good to know what you could do to even get started in optimize for performance....

March 31, 2023 · 7 min · 1292 words · André Sterba
Photo by [Uta Scholl](https://unsplash.com/@uta_scholl) on [Unsplash](https://unsplash.com/photos/ipUuGGUgR5A)

Go Generics

The latest release of Go (1.18) added generics to the language, besides fuzzing, workspaces and performance improvements. 1 So let’s use them to implement the repository pattern, which is a way to abstract data handling from your business logic. When working on REST-like APIs you want to split handling of data from and into some kind of data store (e.g. a database, a file, …) from business logic. This is where the repository pattern comes in handy....

May 1, 2022 · 5 min · 915 words · André Sterba