-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8259074: regex benchmarks and tests #1940
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
8259074: regex benchmarks and tests #1940
Conversation
👋 Welcome back martin! A progress list of the required criteria for merging this PR into |
@Martin-Buchholz The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
652767f
to
cf0922f
Compare
Webrevs
|
1111111 | ||
false 1 | ||
|
||
// Unary power of two (8), reluctant quantifier |
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.
I think the comment here is meant as "Giving a power of 2 as input to the primarily tester", but coming right after a unary primality tester commented with "Unary prime", it sounds like you are labeling this as a power-of-2 detector.
assert ! simple_find(); | ||
assert ! possessive_find(); | ||
assert ! possessive2_find(); | ||
assert ! possessive2_matches(); | ||
assert ! possessive3_find(); | ||
assert ! lookBehind_find(); | ||
assert ! find_loop_two_matchers(); | ||
assert ! find_loop_usePattern(); |
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.
At a risk of muddling the profiles a bit, this can be rewritten as:
if (!simple_find()) throw new IllegalStateException("simple_find is incorrect");
...
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.
Thanks Aleksey. But I was hoping for something more magical.
We really want the checking of the result of the benchmark method to be co-located in the source code with the method, but with zero disturbance to the benchmark numbers. Is such magic possible?
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.
I refactored the correctness checking, no longer using the assert facility.
The assertion discussion aside, the micros look fine to me. With an eye towards reducing total run time I'd ask you to consider if all parameter combinations are useful or if we can get the same value after some pruning. |
@stuart-marks you are invited to review |
@cl4es I agree pruning is a good idea. I settled on 3 data points with 16x separations as good enough to clearly show the difference between O(1) O(N) O(N^2) and O(2^N) (although O(2^N) would "run forever"). (although ... please tell me you're not actually running these benchmarks in an automated fashion ... too expensive, and needs a human to interpret the results) |
Mailing list message from Claes Redestad on core-libs-dev: On 2021-02-01 21:54, Martin Buchholz wrote:
No, we don't automatically pick up and run new microbenchmarks, but I A manual exploration of a new set of micros would naturally start with (It would be nice with some JMH analogue of jtreg's "manual", so |
We're actually in agreement. There's no actual O(2^N) operation here, and jmh is similar to jtreg in having timeouts indicating failure. Although I've been using shell loops as included in the class comments, I'll make sure running the tests using all the defaults gives sensible results. I'm surprised to see jmh use the same number (5) of warmup and measurement iterations. Unless you're looking for very small effects, one warmup run should be sufficient. |
I added annotations for sensible (faster) default, including @WarmUp(iterations = 1) |
Perhaps just a personal preference.. if you instead tune down time per iteration ( |
@Martin-Buchholz This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 23 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
@cl4es Your comment sent me back to jmh re-education camp. I never looked at warmup iterations numbers before, but I now see they can be very useful for eyeballing how long warmup takes. Very JVM-dependent of course. In practice I will stick with my rule of thumb that 10 seconds of warmup is good enough for any simple program, and that happens to be the JMH warmup time default. OTOH I think more than one warmup iteration is overkill for most benchmarks. |
/integrate |
@Martin-Buchholz Since your change was applied there have been 118 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 351d788. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/1940/head:pull/1940
$ git checkout pull/1940