Skip to content

Conversation

@geoffw0
Copy link
Contributor

@geoffw0 geoffw0 commented Mar 4, 2019

This PR rearranges some of the logic in NewDelete.qll to obtain better performance. Correctness is also slightly better (in obscure cases).

@jbj @nickrolfe

@geoffw0 geoffw0 added the C++ label Mar 4, 2019
@geoffw0 geoffw0 requested a review from a team as a code owner March 4, 2019 13:50
@jbj
Copy link
Contributor

jbj commented Mar 4, 2019

I'd like to get this into 1.20 since it fixes a performance regression introduced in 1.20.

@jbj
Copy link
Contributor

jbj commented Mar 4, 2019

To get this into 1.20, either wait for #1032 to be merged and then retarget; or rebase the branch onto upstream/rc/1.20 and then retarget.

Copy link
Contributor

@jbj jbj left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM.

* type `kind`.
*/
private predicate allocReachesVariable(Variable v, Expr alloc, string kind) {
private cached predicate allocReachesVariable(Variable v, Expr alloc, string kind) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the need for cached here? Before this PR, multiple uses of this library took very little extra time, so caching was not needed. See, for example, this log from https://lgtm.com/projects/g/fawkesrobotics/fawkes/logs/rev/c497588cba4b36ae7a24a8e387444d1837866f71/lang:cpp/stage:Build%20child_c497588cba4b36ae7a24a8e387444d1837866f71

[EVALUATION 29/145] Completed query semmlecode-cpp-queries/Critical/NewArrayDeleteMismatch.ql (198s)
[EVALUATION 30/145] Completed query semmlecode-cpp-queries/Critical/NewDeleteArrayMismatch.ql (8s)
[EVALUATION 31/145] Completed query semmlecode-cpp-queries/Critical/NewFreeMismatch.ql (5s)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know exactly why this helps but it seems to:

NewFreeMismatch.ql on fawkesrobotics_fawkes with cached: 226s
NewFreeMismatch.ql on fawkesrobotics_fawkes without cached: 410s

It may just be that it forces things to be computed in a better order, and if so there may be a better way to accomplish this.

Copy link
Contributor

Choose a reason for hiding this comment

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

You can get most of the medicinal effects of cached by using pragma[nomagic] instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, that works just as well. Updated.

@geoffw0 geoffw0 changed the base branch from master to rc/1.20 March 5, 2019 09:07
@geoffw0
Copy link
Contributor Author

geoffw0 commented Mar 5, 2019

Retargetted onto rc/1.20.

@jbj jbj added this to the 1.20 milestone Mar 5, 2019
Copy link
Contributor

@jbj jbj left a comment

Choose a reason for hiding this comment

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

LGTM, and performance is good.

@jbj jbj merged commit 9d595aa into github:rc/1.20 Mar 5, 2019
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