[Checkins] SVN: zc.buildout/branches/davisagli-install-optimization/ Avoid re-scanning the entire environment for distributions after each new package is resolved. That was a pain point observed in profiling of the Plone development buildout, and this change results in a noticable speedup without breaking tests. However, this really needs to be reviewed by someone with more familiarity with buildout and pkg_resources.

David Glick davidglick at onenw.org
Wed Feb 10 23:25:38 EST 2010


Log message for revision 108919:
  Avoid re-scanning the entire environment for distributions after each new package is resolved. That was a pain point observed in profiling of the Plone development buildout, and this change results in a noticable speedup without breaking tests.  However, this really needs to be reviewed by someone with more familiarity with buildout and pkg_resources.

Changed:
  U   zc.buildout/branches/davisagli-install-optimization/CHANGES.txt
  U   zc.buildout/branches/davisagli-install-optimization/src/zc/buildout/easy_install.py

-=-
Modified: zc.buildout/branches/davisagli-install-optimization/CHANGES.txt
===================================================================
--- zc.buildout/branches/davisagli-install-optimization/CHANGES.txt	2010-02-11 04:19:25 UTC (rev 108918)
+++ zc.buildout/branches/davisagli-install-optimization/CHANGES.txt	2010-02-11 04:25:37 UTC (rev 108919)
@@ -4,6 +4,8 @@
 1.4.4 (?)
 =========
 
+- While installing a working set, avoid re-scanning the environment for
+  packages after each additional requirement is resolved.
 
 1.4.3 (2009-12-10)
 ==================

Modified: zc.buildout/branches/davisagli-install-optimization/src/zc/buildout/easy_install.py
===================================================================
--- zc.buildout/branches/davisagli-install-optimization/src/zc/buildout/easy_install.py	2010-02-11 04:19:25 UTC (rev 108918)
+++ zc.buildout/branches/davisagli-install-optimization/src/zc/buildout/easy_install.py	2010-02-11 04:25:37 UTC (rev 108919)
@@ -651,13 +651,10 @@
         # set, but they may have unmet requirements.  We'll simply keep
         # trying to resolve requirements, adding missing requirements as they
         # are reported.
-        #
-        # Note that we don't pass in the environment, because we want
-        # to look for new eggs unless what we have is the best that
-        # matches the requirement.
+        env = pkg_resources.Environment(ws.entries)
         while 1:
             try:
-                ws.resolve(requirements)
+                ws.resolve(requirements, env=env)
             except pkg_resources.DistributionNotFound, err:
                 [requirement] = err
                 requirement = self._constrain(requirement)
@@ -671,6 +668,7 @@
                                            ):
 
                     ws.add(dist)
+                    env.add(dist)
                     self._maybe_add_setuptools(ws, dist)
             except pkg_resources.VersionConflict, err:
                 raise VersionConflict(err, ws)



More information about the checkins mailing list