Rules of thumb for Go

In English, the phrase “rule of thumb” refers to an approximate method for doing something, based on practical experience rather than theory.

Github link.

This project’s aim is simple. To provide some rough baseline measurements for common decisions you have to do every day as a software engineer:

Do I use map or a slice here?

TL;DR: use map when len(haystack) > 100 && len(needles) > 100
I need to deduplicate this, do I use map[T]struct{} or just deduplicate the slice?

TL;DR: use map when len(haystack) > 100. Use slice when the elements are pre-sorted.

There is many more in the repository. There are so many discussions like these in every engineering team. It often comes up in code reviews - “you should use *struct here instead of copying”. OK, but why? At what point is it beneficial?

This is what I’m trying to provide some data for.