Skip to content

JS: improve the join order of getAClassReference #8550

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

Merged
merged 4 commits into from
Apr 12, 2022

Conversation

erik-krogh
Copy link
Contributor

Saves ~10s on VSCode.

I didn't think such a noopt should do a difference, but it did.

I'm doing an evaluation, I will only merge if that turns out OK.

@erik-krogh erik-krogh added the no-change-note-required This PR does not need a change note label Mar 24, 2022
@erik-krogh erik-krogh requested a review from a team as a code owner March 24, 2022 15:32
@erik-krogh erik-krogh added the JS label Mar 24, 2022
}

pragma[noopt]
private DataFlow::SourceNode getAClassReferenceStep(DataFlow::TypeTracker t) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private DataFlow::SourceNode getAClassReferenceStep(DataFlow::TypeTracker t) {
private DataFlow::SourceNode getAClassReferenceRec(DataFlow::TypeTracker t) {

We have other cases of a type-tracking "step" predicates being factored out to fix a join ordering, but where some information about the edge itself is matched. This here is just the whole recursive case being factored, so I'd prefer a different name. I was certainly confused for a second, before realising that the noopt is reason for factoring it out.

Copy link
Contributor

@asgerf asgerf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but let's wait for the evaluation

@erik-krogh
Copy link
Contributor Author

I made a mistake in the inlining, which caused a test to fail, so this PR might have been for nothing.
I'll try to run an evaluation anyway. If that turns out neutral (which I expect), then I'll close this PR.

@@ -970,7 +970,7 @@ class ClassNode extends DataFlow::SourceNode instanceof ClassNode::Range {
exists(DataFlow::TypeTracker t2, StepSummary summary, DataFlow::SourceNode prev |
prev = this.getAClassReference(t2) and
StepSummary::step(prev, result, summary) and
t2 = t.append(summary)
t = t2.append(summary)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smells like a ql4ql query...

@erik-krogh
Copy link
Contributor Author

I ran an evaluation.
And it shows improved performance 😕

No improvement on VSCode (which was the original intent), but other projects see a real performance improvement.

I think we should merge this, and I should look into improving the join-order of our type-trackers.

@codeql-ci codeql-ci merged commit a43f3a2 into github:main Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JS no-change-note-required This PR does not need a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants