In true Shane fashion I just realized the title makes it seem like it’s talking about performance changes in go1.21. It’s not. I just wanted to document the go version I was testing with.
Excellent article, worth reading for the benchmarking instructions alone. I did not knew about the -cpu flag before, which is pretty handy for running a benchmark with different core counts! It probably is a convenience thing that sets GOMAXPROCS, but this is just an assumption since I did not look up how the flag is actually implemented.
My assumption was correct (godoc):
Specify a list of GOMAXPROCS values for which the tests, benchmarks or
fuzz tests should be executed. The default is the current value
of GOMAXPROCS. -cpu does not apply to fuzz tests matched by -fuzz.
That’s right and also *testing.B.RunParallel keys off of GOMAXPROCS to determine how many goroutines to run in parallel https://pkg.go.dev/testing#B.RunParallel