From 24cddb6901d8c0421bcff4daa465e422e2d27f44 Mon Sep 17 00:00:00 2001 From: Campbell Jones Date: Wed, 19 Jun 2024 18:48:46 -0400 Subject: create_test_serialisation: Dedup deps before joining ld_lib paths In large monolithic codebases with many intertwined shared libraries, test serialization can cause configuration times to balloon massively from a single test() invocation due to concatenating the same paths many times over. This commit adds an initial set in which all dependencies on a test target are stored before their paths are constructed to form the test target's LD_LIB_PATH. In testing on a particularly large codebase, this commit reduced total configuration time by a factor of almost 8x. --- mesonbuild/backend/backends.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index c1a72f1..0552110 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -1263,12 +1263,16 @@ class Backend: t_env = copy.deepcopy(t.env) if not machine.is_windows() and not machine.is_cygwin() and not machine.is_darwin(): - ld_lib_path: T.Set[str] = set() + ld_lib_path_libs: T.Set[build.SharedLibrary] = set() for d in depends: if isinstance(d, build.BuildTarget): for l in d.get_all_link_deps(): if isinstance(l, build.SharedLibrary): - ld_lib_path.add(os.path.join(self.environment.get_build_dir(), l.get_subdir())) + ld_lib_path_libs.add(l) + + env_build_dir = self.environment.get_build_dir() + ld_lib_path: T.Set[str] = set(os.path.join(env_build_dir, l.get_subdir()) for l in ld_lib_path_libs) + if ld_lib_path: t_env.prepend('LD_LIBRARY_PATH', list(ld_lib_path), ':') -- cgit v1.1