C++: Speed up SuspiciousAddWithSizeof select#3352
Merged
Merged
Conversation
This `select` clause had become very slow after we started caching
`ElementBase::toString` because the query used string concatenation to
produce alert messages, and those string concatenations were done very
early in the pipeline, producing lots of strings that would be discarded
moments later.
By using `$@` to interpolate elements into strings, the concatenation is
done outside of QL.
Testing on a Chromium snapshot, this commit takes us from
#select#ff ................ 6m2s
to
#select#cpe#134#fff ....... 15.2s
MathiasVP
approved these changes
Apr 24, 2020
MathiasVP
left a comment
Contributor
There was a problem hiding this comment.
LGTM (assuming the tests pass).
Would it be worthwhile to go through the LGTM suite and check if other queries suffer from the same issue? I suppose this can almost be done with a grep
Contributor
Author
I'd prefer not to make queries uglier if they don't have a substantial performance problem. If we can solve https://github.com/github/codeql-c-analysis-team/issues/56 in the libraries and/or optimiser, that seems better than chasing down individual queries. |
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.
This
selectclause had become very slow after we started cachingElementBase::toStringbecause the query used string concatenation to produce alert messages, and those string concatenations were done very early in the pipeline, producing lots of strings that would be discarded moments later.By using
$@to interpolate elements into strings, the concatenation is done outside of QL.Testing on a Chromium snapshot, this PR takes us from
to