From 468d1a05ec0a020150e34fb2f0865e3971679c23 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Fri, 2 Nov 2018 14:30:04 +0100 Subject: [PATCH] meson: cache get_target_generated_dir This reduces the build time about 2 sec. The result itself is not hard to calculate. However, persistent join calls with the same 2 strings are not that usefull. This also caused about 600'000 calls to get_target_dir, we are now down to 60'000 calls form this function to get_target_dir. --- mesonbuild/backend/backends.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 6a3d936ee..374b7fb7a 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -26,6 +26,7 @@ from ..mesonlib import File from ..compilers import CompilerArgs from collections import OrderedDict import shlex +from functools import lru_cache class CleanTrees: @@ -210,6 +211,7 @@ class Backend: def get_target_private_dir_abs(self, target): return os.path.join(self.environment.get_build_dir(), self.get_target_private_dir(target)) + @lru_cache(maxsize=None) def get_target_generated_dir(self, target, gensrc, src): """ Takes a BuildTarget, a generator source (CustomTarget or GeneratedList),