testing: benchmark output is not properly aligned on large b.N values #22144
Labels
Milestone
Comments
Why NeedsFix? It's a minor cosmetic issue whose solution is disproportionate to its severity. |
It's OK with me if you just want to close it. |
OK, closing. The solution would require implementing a columnator in the testing package, or using something like tabwriter, but that would destroy the dependency tree for the package. If you care about alignment, I suggest taking https://github.com/robpike/tab/blob/master/main.go plus a little work to turn the spaces into tabs before passing the text to tabwriter. If you want numeric alignment, it's even more work though. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What did you do?
What did you expect to see?
Middle column aligned.
What did you see instead?
Note how the first line for
BenchmarkMutexUncontended
breaks alignment since 100M run count doesn't fit%8d
format defined here:go/src/testing/benchmark.go
Line 351 in 24e4a12
8475832 introduced scaling of ns/op reported to 0.01ns, but for such small numbers cycle count may not fit 8 symbols, so maybe it's worth increasing width to 9-10 digits?
System details
The text was updated successfully, but these errors were encountered: