-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
testing: benchmark results are not well aligned #8780
Labels
Milestone
Comments
In my opinion this should be solved with external tools, e.g. by piping go test's output through column(1) -- with the -t flag it produces output that is very close to the desired format. Alternatively, there's github.com/cespare/prettybench which adds some other improvements to the output as well as fixing the alignment. Also I don't understand how "periodically flushing the output" is supposed to work. If you want all columns to line up properly, you need to buffer the entire output. If you flush periodically, you will constantly change the alignment. I feel like streaming output is far more valuable than perfect alignment. |
Comment 3 by jasonhall@google.com: Yeah, that makes sense. I hadn't seen prettybench, that's pretty nice, I can use that in the meantime :) "Periodically flushing" probably isn't even necessary, like you said it would cause misalignments between flushed sections. Are there normally enough results being shown that flushing would even be necessary? Probably not. It comes down to whether streamed results are more useful than aligned results. What are the benefits of streamed results? |
I don't think that this necessarily requires giving up streamed results. The test binary knows up front the names of all the benchmarks that it will run, and it could provide ample padding to allow for long run times. However, I'm not sure it is worth the extra code. It is very easy to borrow some code from benchcmp (http://godoc.org/code.google.com/p/go.tools/cmd/benchcmp) to parse the output, which you can then reformat to your heart's content, including sorting by benchmark times to see the relative ordering. Whatever we do, let's keep streamed results. Streamed results let you see progress as it happens. For example, the math/big package has 133 benchmarks. It is useful to see that individual benchmarks are completing in a reasonable time instead of waiting several minutes to find out what has happened. It is also useful to be able to peek at the first few results to see whether to let the rest of the benchmarks run. |
Mailed https://go-review.googlesource.com/2840. This change does an initial round to filter out all the matching benchmarks and simultaneously calculates how to pad the benchmark names in order to align the results. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by jasonhall@google.com:
The text was updated successfully, but these errors were encountered: