diff options
author | Campbell Jones <serebit@archlinux.org> | 2024-06-19 18:48:46 -0400 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2024-06-23 12:13:36 +0300 |
commit | 24cddb6901d8c0421bcff4daa465e422e2d27f44 (patch) | |
tree | 872106fb4b8ab1ed85b69082b9c25af93a5c2295 | |
parent | 410bdf8c6c72fd1a2772e86a2a14298f64f1377b (diff) | |
download | meson-24cddb6901d8c0421bcff4daa465e422e2d27f44.zip meson-24cddb6901d8c0421bcff4daa465e422e2d27f44.tar.gz meson-24cddb6901d8c0421bcff4daa465e422e2d27f44.tar.bz2 |
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.
-rw-r--r-- | mesonbuild/backend/backends.py | 8 |
1 files 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), ':') |