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.
pull/11445/head
Campbell Jones 5 months ago committed by Jussi Pakkanen
parent 410bdf8c6c
commit 24cddb6901
  1. 8
      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), ':')

Loading…
Cancel
Save