buildtools: Don’t call normpath() repeatedly
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Thu, 12 Oct 2023 22:23:27 +0000 (11:23 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 17 Oct 2023 03:19:38 +0000 (03:19 +0000)
A non‐negligible fraction of the build process — especially for
incremental builds — is spent calling normpath() over and over again.

Make builds faster by not doing that.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
buildtools/wafsamba/samba_utils.py

index 39512f0ac9639680bf82eaaac3832ce98d439734..b22b7a8879b1db373b9396ff2d68ac6928076b82 100644 (file)
@@ -710,8 +710,9 @@ def samba_before_apply_obj_vars(self):
     """before apply_obj_vars for uselib, this removes the standard paths"""
 
     def is_standard_libpath(env, path):
+        normalized_path = os.path.normpath(path)
         for _path in env.STANDARD_LIBPATH:
-            if _path == os.path.normpath(path):
+            if _path == normalized_path:
                 return True
         return False