-
Notifications
You must be signed in to change notification settings - Fork 67
Description
As per the title, we're seeing incredibly long run times when running fixit==2.1.0.
Our code base is approx 4M lines of python code. On a Circle CI Large instance (4 CPU / 8gb), it takes up to an hour to run across the entire code base. We've worked around this by only running on changed files, which takes approximately 1 minute, except when we edit the fixit config or any of our custom rules where we'll run the entire suite.
I'm keen to try and understand why the runs may be slow by profiling in some way. Is there any tooling or logging available within fixit itself that might help to track down where some of the problems may be? To be clear, I'm coming at this from the assumption that the way we've written our rules is mostly to blame, and would like to identify the worst offenders.
While I'm not really able to share our implementations, I can provide some details of our current usage (if that might prompt some thoughts of "oh, of course that would be slow!":
We make heavy use of QualifiedNameProvider and FilePathProvider.
We have lots of helper functions that presumably construct lots of instances, like so:
def is_django_model_class(visitor: LintRule, node: cst.ClassDef) -> bool:
model_class = QualifiedName(name="django.db.models.Model", source=QualifiedNameSource.IMPORT)
for base_class in node.bases:
if QualifiedNameProvider.has_name(visitor, base_class.value, model_class):
return True
...
def visit_ClassDef(self, node: cst.ClassDef) -> None:
is_django_model_class = helpers.is_django_model_class(self, node)
...Still, I'm more interested in being able to analyse performance and profiling data myself rather than guessing, so anything in this space would be incredibly helpful.