-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
x/perf/benchstat: add a mode to compare across git refs #34311
Comments
Just to compare as well, here is the full output of the equivalent "manual" run:
|
I sympathise with the idea and effort here; automating this would be nice. I don't think benchstat is the right tool, though. All it does is compare benchmark numbers; it is not at all specific to Go, or to running Go benchmarks via I think your idea is good, but it should be a tool on top of benchstat. For example, imagine a program that depends on |
I've been wanting to do something similar, but more general. I need to be able to run arbitrary go commands against different commits, not just benchmarks. I've just been writing bash scripts to do it, all the while knowing there must be a more elegant solution. |
Take a look at https://github.com/josharian/compilecmp, which runs compiler benchmarks across different commits. |
😆 sound good @mvdan, I'll work on this when I have a chance, spin it off, and link it when it's ready. |
@vancluever have you checked the tools above? It's probable that you can either directly use (or quickly adapt) either of them for your needs. |
@mvdan I did take a quick look over, and both definitely seem to do things that would cover this case. Honestly, this was more about seeing if the work that I did here (I made this 6 months ago to help with gathering benchmarks for the above CLs) would be useful to contribute - but I do agree it it's overloading x/perf's concerns. In light of that and the prior art, I'm just going to close this and if I really feel like there's something that would make sense to include, I'll open a new proposal. Thanks! And thanks @zdjones and @josharian for the suggestions. |
Currently, benchstat requires input files used for comparison be generated and supplied "manually", ie: out-of-band from benchstat itself.
A workflow for a git comparison would follow something like:
go test -count=SOME_SIGNIFICANT_COUNT -bench=. ... > old.txt
.go test -count=SOME_SIGNIFICANT_COUNT -bench=. ... > new.txt
.A while ago I decided to make a change to benchstat to help eliminate some of this busywork, in addition to help ease the benchmarking of two arbitrary points - say you wanted to compare a benchmark between two arbitrary commits to check for regressions, etc.
To see what the changes would look like, the commit is here: https://github.com/vancluever/perf/commit/4539336fbe2794f1f28d49e87566915746ab69fa
Basically, the workflow for "git mode" would be:
Basically, all of the above commit is lacking to be CL-worthy is:
git rev-parse --abbrev-ref HEAD
gives HEAD, not the ref (ie: tag or commit). This actually prevents benchstat from testing the correct refs when only supplied an old ref, or switching back to the previous HEAD when supplied two.If this proposal is accepted, I'll work on fixing detached HEAD discovery, add the tests, and put in the CL. 🙂
To show it completely in action, below is the output of me using it to run the benchmarks from https://go-review.googlesource.com/c/go/+/163862, between when they were added, and when https://go-review.googlesource.com/c/go/+/163599 was merged, correcting the HTTP/1.1 Transport's ReaderFrom implementation issues. These are the darwin/amd64 tests, but as they are run on my local laptop which is not necessarily the most controlled environment (in addition to using go 1.12.9 built with 1.13), there might be some skew from what is in 163599, which was submitted some 6 months ago. Since we're comparing across commits as well, it's also including other commits that would not be included by comparing a single commit to master.
The text was updated successfully, but these errors were encountered: