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.
pull/7119/head
Marcel Hollerbach 5 years ago
parent cca06e4c33
commit 256e910dee
  1. 8
      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'):

Loading…
Cancel
Save