-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[core] [java] More micro opts #4417
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-5% runtime on openjdk (all java rules).
make better use of the cache
Generated by 🚫 Danger |
adangel
added
the
for:performance
The goal of this change is to improve PMD's performance
label
Mar 17, 2023
adangel
reviewed
Mar 17, 2023
pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/Attribute.java
Outdated
Show resolved
Hide resolved
pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/impl/AttributeAxisIterator.java
Show resolved
Hide resolved
pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/internal/AstTreeInfo.java
Show resolved
Hide resolved
pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symbols/internal/SymbolEquality.java
Outdated
Show resolved
Hide resolved
adangel
approved these changes
Mar 21, 2023
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, looks good!
Benchmark (sourceFname) Mode Cnt Score Error Units StreamBench.foreachOnChildrenStream /PLSQLParser.java avgt 4 14,992 ± 0,169 ms/op StreamBench.foreachOnChildrenStreamOpt /PLSQLParser.java avgt 4 8,179 ± 0,141 ms/op StreamBench.loopOnChildrenStream /PLSQLParser.java avgt 4 9,694 ± 0,549 ms/op StreamBench.optimizedLoop /PLSQLParser.java avgt 4 7,631 ± 0,143 ms/op "foreachOnChildrenStreamOpt" is the new implementation, the old is "foreachOnChildrenStream". For comparison, this new impl of forEach with a lambda appears slightly faster than using a for-each loop on the children stream, and using a manually indexed loop (with getChild) is slightly faster.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe the PR
Overall I can measure a consistent ~8% improvement in runtime (on openjdk sources, all java rules, 1 thread).
Related issues
Related to #4353
Ready?
./mvnw clean verify
passes (checked automatically by github actions)