Skip to content

C++: Further performance improvement for the null termination queries #7018

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 3 commits into from
Nov 4, 2021

Conversation

geoffw0
Copy link
Contributor

@geoffw0 geoffw0 commented Nov 1, 2021

Follow-up to #6915.

The goal here was to eliminate the mutual recursion between mayAddNullTerminator and mayAddNullTerminatorHelper, which was still causing unnecessarily slow performance on a few projects. I'm not sure if I've found the best solution to this - in particular mayAddNullTerminatorHelper looks quite large to me, though I haven't seen it blow up in practice. Happy to take further suggestions.

The change has a small positive effect on performance locally. I ran DCA on this (actually a variant with the two queries enabled) and only saw a 29s overall improvement there, which is likely not statistically significant.

@MathiasVP

@geoffw0 geoffw0 added the C++ label Nov 1, 2021
@geoffw0 geoffw0 requested a review from a team as a code owner November 1, 2021 19:26
Copy link
Contributor

@MathiasVP MathiasVP left a comment

Choose a reason for hiding this comment

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

LGTM (with the exception of a small QLDoc nitpick).

Comment on lines +50 to +51
mayAddNullTerminatorHelper(e, va, v0) and
mayAddNullTerminator(pragma[only_bind_into](e0), pragma[only_bind_into](v0.getAnAccess())) and
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I see why this speeds it up. Previously, we were computing an SCC consisting of {mayAddNullTerminator, mayAddNullTerminatorHelper}, but now we're computing mayAddNullTerminatorHelper first, and then evaluating an SCC just containing mayAddNullTerminator. So this doesn't change any query results. Is that a correct description of what's going on?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's my understanding as well. The tricky part is that we may be computing a bigger (less constrained) mayAddNullTerminatorHelper relation in the first place, but I haven't seen that be a problem.

Co-authored-by: Mathias Vorreiter Pedersen <mathiasvp@github.com>
Copy link
Contributor

@MathiasVP MathiasVP left a comment

Choose a reason for hiding this comment

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

LGTM!

@MathiasVP MathiasVP merged commit 34aa498 into github:main Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants