C++: Rewrite reachable without mutual recursion#170
Closed
jbj wants to merge 1 commit intogithub:masterfrom
Closed
C++: Rewrite reachable without mutual recursion#170jbj wants to merge 1 commit intogithub:masterfrom
reachable without mutual recursion#170jbj wants to merge 1 commit intogithub:masterfrom
Conversation
This gives a measurable speedup, and I think it makes the code clearer. Before this, the `reachable` and `successors_adapted` predicates were mutually recursive together with four other predicates over two files. This adds `successors_adapted` to the global name space, which is not really desired but not harmful either.
Contributor
Author
|
The test failure looks like a real problem. I'll look into it. |
Contributor
Author
|
Notes to self: The Since |
Contributor
Author
|
This branch was not quite ready for PR. Closing. |
aibaars
pushed a commit
that referenced
this pull request
Oct 14, 2021
Add `rb/overly-permissive-file` query
smowton
pushed a commit
to smowton/codeql
that referenced
this pull request
Jan 17, 2022
Java/Kotlin: Tweak consistency queries
MathiasVP
pushed a commit
to MathiasVP/ql
that referenced
this pull request
Aug 10, 2025
…-packs Publish Public Packs
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 gives a measurable speedup, and I think it makes the code clearer. Before this, the
reachableandsuccessors_adaptedpredicates were mutually recursive together with four other predicates over two files.I measured these benchmarks, where the numbers came from subtracting timestamps in the log rather than trusting the "Clause timing report" at the end:
I tested correctness and performance with this query, which gives the same results before and after:
These changes were supposed to be a refactoring to enable even more ambitious speedups of the
reachablepredicate, but they bring large enough improvements on their own that I'd like to submit them as a separate PR. It's not clear whether it's worth following up with changes to make the code faster but more complex.The performance issue with
reachableis that it has a recursive occurrence on both sides of anand. That was hidden before but is visible after this refactoring. It's more expensive to compute such a general case of recursion than the usual case where one side of everyandis constant.