Java: Fix more broken performance.#20383
Merged
IdrissRio merged 1 commit intogithub:mainfrom Sep 8, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes performance issues in Java CodeQL queries by adding pragma[nomagic] annotations and pragma[only_bind_out] / pragma[only_bind_into] directives to optimize query evaluation. These pragmas help the CodeQL evaluator make better decisions about join ordering and variable binding to avoid expensive cartesian products.
Key changes:
- Added performance optimization pragmas to predicates and variable bindings
- Refactored query structure to improve evaluation efficiency
- Replaced transitive closure with iterative predicate for better performance
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| java/ql/src/Likely Bugs/Likely Typos/SelfAssignment.ql | Added pragma[nomagic] and pragma[only_bind_out] to optimize predicate evaluation |
| java/ql/src/Likely Bugs/Frameworks/Swing/BadlyOverriddenAdapter.ql | Added pragma[nomagic] and refactored query structure to extract candidate method into separate predicate |
| java/ql/src/Likely Bugs/Collections/RemoveTypeMismatch.ql | Added pragma[only_bind_into] to optimize parameter index binding |
| java/ql/src/Likely Bugs/Collections/ContainsTypeMismatch.ql | Added pragma[only_bind_into] to optimize parameter index binding |
| java/ql/lib/semmle/code/java/frameworks/android/ExternalStorage.qll | Replaced recursive transitive closure with iterative predicate for better performance |
| java/ql/lib/semmle/code/java/dataflow/internal/TaintTrackingUtil.qll | Added pragma[only_bind_into] to optimize argument index binding |
8e8c5ff to
4c1fa58
Compare
IdrissRio
approved these changes
Sep 8, 2025
This file contains hidden or 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
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.
#20380 didn't quite cut it - there were many more cases of broken performance. This covers most things, I think.