diff options
author | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2020-05-07 13:35:35 +0200 |
---|---|---|
committer | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2020-06-05 09:02:23 +0200 |
commit | cca06e4c336da1684f90da607c6a2cd591747fce (patch) | |
tree | 54f597fcd5d6ed124281334ae86607035fd1bdf5 | |
parent | 2e30afb23b0f34308c747b1e799b66a2f992d398 (diff) | |
download | meson-cca06e4c336da1684f90da607c6a2cd591747fce.zip meson-cca06e4c336da1684f90da607c6a2cd591747fce.tar.gz meson-cca06e4c336da1684f90da607c6a2cd591747fce.tar.bz2 |
ninjabackend: cache calls to normpaths
calls to normpaths are expansive. We should cache the results. This
safes 2s in the configure time of efl.
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 69e7618..6cf8026 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -2004,6 +2004,10 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485''')) curdir = '.' return compiler.get_include_args(curdir, False) + @lru_cache(maxsize=None) + def get_normpath_target(self, source) -> str: + return os.path.normpath(source) + def get_custom_target_dir_include_args(self, target, compiler): custom_target_include_dirs = [] for i in target.get_generated_sources(): @@ -2012,7 +2016,7 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485''')) # own target build dir. if not isinstance(i, (build.CustomTarget, build.CustomTargetIndex)): continue - idir = os.path.normpath(self.get_target_dir(i)) + idir = self.get_normpath_target(self.get_target_dir(i)) if not idir: idir = '.' if idir not in custom_target_include_dirs: |