indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The build_ext distutils command in Python 3.5+ has a "parallel"
  option that controls whether to build extensions in parallel. It
  is disabled by default (None) and can be set to an integer value
  for number of cores or True to indicate use all available CPU
  cores.
  
  This commit changes our build_ext command override to set
  "parallel" to True unless a value has been provided by the caller.
  
  On my machine, this makes `python setup.py build_ext` 1-4s faster.
  It is worth noting that at this time, each individual source file
  constituting the extension is still built serially. For Mercurial,
  this means that we can't build faster than the slowest-to-build
  extension, which is the zstd extension by a long shot. This means
  that setup.py is still not very efficient at utilizing multiple
  cores. But we're better than before.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6923

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -490,6 +490,14 @@
 
         return build_ext.initialize_options(self)
 
+    def finalize_options(self):
+        # Unless overridden by the end user, build extensions in parallel.
+        # Only influences behavior on Python 3.5+.
+        if getattr(self, 'parallel', None) is None:
+            self.parallel = True
+
+        return build_ext.finalize_options(self)
+
     def build_extensions(self):
         ruststandalones = [e for e in self.extensions
                            if isinstance(e, RustStandaloneExtension)]



To: indygreg, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to