Greetings! I was testing a simple function and noticed that the benchmarks for
fmt.Sprintf seem much slower as opposed to just concatenating the strings. I suppose it’s doing some more stuff under the hood. The memory benchmarks also seem worse. Am I reading the benchmarks wrong or misunderstanding them? Should I try to avoid using
fmt.Sprintf for simple concatenations? Is this a negligible micro optimization that I don’t need to worry about? Thanks!
fmt.Sprintf("One for %v, one for me.", name) // BenchmarkShareWith-12 2779749 428.4 ns/op 128 B/op 6 allocs/op
"One for " + name + ", one for me." // BenchmarkShareWith-12 20134160 59.12 ns/op 0 B/op 0 allocs/op