You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This rule was identified as containing one of the slowest predicates in
our C Coding Standards query suites, and this commit improves the
performance.
Performance is improved with the following changes:
(a) Factoring out a predicate for the repeated calls to getTarget(), to
avoid duplication and to create a semantically meaningful predicate
which gets the target for a reference to an external identifier.
(b) Use the factored out predicate to refine the reference class to
only be references to external identifiers. This reduces the size
of the class.
(c) Create a predicate for computing a table of external identifiers,
references to those identifiers and the translation units those
exist in. We can then compute this table once, and use it in both
the "find me a reference to this external identifier" case and in
the "where the external identifier is not referenced in any other
translation unit" case.
Part (c) is the critical change. Without that, the optimizer was
creating an expensive join order in the negation case, where it
was effectively creating a cross product of all references to each
external identifier, before later excluding on the negation. The use
of our predicate in the negation case means we can first create a table
of external identifiers and translation units, then apply that in the
negation case without cross producting the references.
0 commit comments