-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Initial take at adding JMH micro-benchmarks #12663
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
Conversation
|
@dweiss thank you for this! I tried it out and it works great. Glad to see the |
|
Let me review the minor remaining bits - I had to leave the computer before the tests completed. |
|
@dweiss this is awesome!!! Thank you so much! |
|
@dweiss one suggestion I have is adding a I tested this locally and was able to follow your directions and get the benchmarks to run without issue. |
|
I enabled forbiddenapis to the extent possible, to make Uwe happier. ;) I like those flame-graphs that Solr has, etc., but these can come later. I'll add a simple |
|
@benwtrent Can you take a look? If there's any wording you think would work better, please do change it. Explaining how JMH works is perhaps beyond the scope of the readme file... ;) |
| -h displays verbose help for all options | ||
| -l list available benchmarks | ||
| -lp list benchmarks that pass the filter and their parameters | ||
| regexp execute all benchmark containing regexp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| regexp execute all benchmark containing regexp | |
| regexp execute all benchmark containing regexp | |
| Here is an example running a single benchmark: | |
| java --module-path lucene\benchmark-jmh\build\benchmarks --module org.apache.lucene.benchmark.jmh org.apache.lucene.benchmark.jmh.BinaryCosineBenchmark.cosineDistanceNew | |
| Or running all of BinaryCosineBenchmark | |
| java --module-path lucene\benchmark-jmh\build\benchmarks --module org.apache.lucene.benchmark.jmh org.apache.lucene.benchmark.jmh.BinaryCosineBenchmark |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, apologies - I thought you added that change to the branch, not as github's suggested change. I added this manually.
|
Looks good @dweiss I added a line with an example for running a single benchmark or suite of benchmarks. |
As per discussion in: #12641
This patch adds the ability to compile JMH microbenchmarks and run them from within Lucene codebase. I didn't use any plugins as they, in my opinion, obscure the view of what's happening and what's needed. I also wanted it to work with the module system and without uber-jars.
compiles microbenchmarks with JMH, then displays a short help on what to do next:
I didn't add any gradle-specific tasks to run the benchmarks directly - it's technically easy but it seems like a bad idea to fork a subprocess from (quite heavy) gradle when such delicate things are being measured? I'm not sure here.
Some future improvements/ remaining issues include: