Go int to string performance
Why this post? It’s not exactly the sexiest of topics but it’s something we do a lot of as developers, outputting integers as strings. But there are some huge differences in performance depending on how you go about this in Go. Round 1 - fmt.Sprintf() The first contender here is fmt.Sprintf a handy goto for a lot of string formatting problems. So we have the code below, we’ll be using this simple loop and a string builder for all the examples to get a true measure of the differences....