diff options
author | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2020-05-07 13:37:11 +0200 |
---|---|---|
committer | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2020-06-05 09:02:23 +0200 |
commit | 256e910dee90bda81286f31081b56a707f267e0d (patch) | |
tree | 7d660b60eebd0c82504019aa37907e7f466890a2 | |
parent | cca06e4c336da1684f90da607c6a2cd591747fce (diff) | |
download | meson-256e910dee90bda81286f31081b56a707f267e0d.zip meson-256e910dee90bda81286f31081b56a707f267e0d.tar.gz meson-256e910dee90bda81286f31081b56a707f267e0d.tar.bz2 |
cache up regex mathings
the names passed in here are often the same. We should ensure that we
cache the regex match, as this will speed up our runtime a lot.
-rw-r--r-- | mesonbuild/compilers/compilers.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index b0fa5f5..ce1016d 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -138,11 +138,15 @@ def is_llvm_ir(fname): fname = fname.fname return fname.split('.')[-1] == 'll' +@lru_cache(maxsize=None) +def cached_by_name(fname): + suffix = fname.split('.')[-1] + return suffix in obj_suffixes + def is_object(fname): if hasattr(fname, 'fname'): fname = fname.fname - suffix = fname.split('.')[-1] - return suffix in obj_suffixes + return cached_by_name(fname) def is_library(fname): if hasattr(fname, 'fname'): |