Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
testing: benchmark output is not properly aligned on large b.N values #22144
What did you do?
What did you expect to see?
Middle column aligned.
What did you see instead?
Note how the first line for
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?
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.