Skip to content

Commit

Permalink
Speedup get_plugin_linter_classes (#59)
Browse files Browse the repository at this point in the history
get_plugin_linter_classes is  called once per file being processed and
can take hundreds of ms per file, which over a large code base of
hundreds or thousands of files slows things down noticeably. use an
lru_cache here as the code should always return the same thing inside a
single process.
  • Loading branch information
jogo committed Mar 9, 2023
1 parent 3b19294 commit 01b5df7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dlint/extension.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python

import functools
import importlib
import inspect
import pkgutil
Expand Down Expand Up @@ -56,6 +57,7 @@ def parse_options(cls, options):
cls.options = options

@classmethod
@functools.lru_cache()
def get_plugin_linter_classes(cls):
module_prefix = 'dlint_plugin_'
class_prefix = 'Dlint'
Expand Down

0 comments on commit 01b5df7

Please sign in to comment.