-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
feat: Add initial benchmarking setup #3120
base: master
Are you sure you want to change the base?
feat: Add initial benchmarking setup #3120
Conversation
Will execute on pull requests, and run all benchmarks against master and post a comparison as a PR comment
… this in two steps
It ran the initial benchmarks on this PR, but failed to post the comments due to permissions. I changed the event to be pull_request_target, so it will only start running on PR's after this is merged. (since it needs to be in master) The reason for the event change is explained here This is what it would have posted after the initial commit: Note These results are affected by shared workloads on GitHub runners. Use the results only to detect possible regressions, but always rerun on more stable machine before making any conclusions! Benchmark results (pull-request, 1339c93)
See https://github.com/mybatis/mybatis-3/pull/3120/checks?sha=1339c93d34e870d0794ec6de460841adee5a903c for where it tried to post ;-) |
Thank you for the PR, but I don't like the idea very much. In terms of performance, our focus is mostly on the mapping part (i.e. setting parameters, getting column values). So, this benchmark will not reflect the effect on production usage correctly and could encourage micro-optimization (which, in most cases, is not a good thing). |
Thank you for the feedback @harawata, I should have been more clear, the included benchmark is just a dummy, this PR was more meant to showcase that we can have the possibility to include benchmarks in mybatis that matter, whatever that might mean for the project. I've gone over a few past PRs and seen benchmarks here and there, and it's a pity that they cannot stay withing the code base and demonstrate particular improvements (or most importantly, regressions) The benchmark I have on my branch of #101 reflects a more real scenario and definitely helped me ensure we do not affect current result mapping performance. I do agree that we definitely do not want micro improvements! And that was also not supposed to be the purpose here. But feel free to close if you think this was not a good idea ;-) and thanks for taking a look! |
Thank you for the follow-up. And, in case we adopt this, I would also like to see memory usage which is equally important as execution speed (I assume it's not included in the current setup, but correct me if I am wrong). @hazendaz @kazuki43zoo Any thoughts? |
To share some experience, we've been using this setup for a couple of months on one of our open source projects, it helped us quite a lot for detecting regressions early and then investigating further the results. We run it on every PR (around 50 PRs so far) and currently have 10 benchmarks in total, which takes around 6 minutes in total to execute on both master and PR branches (though you could tune that a bit to run less iterations or fewer benchmarks). To reduce the noise, pipeline could also use labels / comments / manual dispatch as a trigger so that you manually trigger it when a PR is touching something that could affect the performance. We used that setup on one of our projects (not open-source, but also on GitHub). If that would be relevant for you, I could help with the implementation.
From what I could find, the GitHub doesn't count this usage on open-source projects towards its GitHub Actions limits. Also, despite running on shared GitHub runners, the results were consistent (+-10%) for us, though it's better to rerun the benchmarks on some stable hardware when in doubt. |
Thats correct ;-) Ill add it to this PR. After #101 Merges, I can create a PR to drop these dummy benchmarks in favor of the ones I built in https://github.com/epochcoder/mybatis-3/commits/feature/101-jmh-performance-test/ |
Will execute on pull requests, and run all benchmarks against
master and post a comparison as a PR comment
This will allow the maintainers of MyBatis to have concrete results for important flows on every pull request measured against master, I believe this would greatly help with PR's that say, "I've improved performance"
Thanks to @gavlyukovskiy for the benchmarking pipeline setup