[Checkins] SVN: zc.buildout/branches/dist-cache/ Avoid sorting the working set and requirements when it won't be logged.
Ross Patterson
me at rpatterson.net
Mon Jan 16 22:58:51 UTC 2012
Log message for revision 124061:
Avoid sorting the working set and requirements when it won't be logged.
Backport 124059 from trunk.
Changed:
U zc.buildout/branches/dist-cache/CHANGES.txt
U zc.buildout/branches/dist-cache/src/zc/buildout/easy_install.py
-=-
Modified: zc.buildout/branches/dist-cache/CHANGES.txt
===================================================================
--- zc.buildout/branches/dist-cache/CHANGES.txt 2012-01-16 22:46:38 UTC (rev 124060)
+++ zc.buildout/branches/dist-cache/CHANGES.txt 2012-01-16 22:58:50 UTC (rev 124061)
@@ -4,6 +4,13 @@
1.6.0 (unreleased)
==================
+- Avoid sorting the working set and requirements when it won't be
+ logged. When profiling a simple buildout with 10 parts with
+ identical and large working sets, this resulted in a decrease of run
+ time from 93.411 to 15.068 seconds, about a 6 fold improvement. To
+ see the benefit be sure to run without any increase in verbosity
+ ("-v" option). (rossp)
+
- The buildout init command now accepts distribution requirements and
paths to set up a custom interpreter part that has the distributions
or parts in the path. For example::
Modified: zc.buildout/branches/dist-cache/src/zc/buildout/easy_install.py
===================================================================
--- zc.buildout/branches/dist-cache/src/zc/buildout/easy_install.py 2012-01-16 22:46:38 UTC (rev 124060)
+++ zc.buildout/branches/dist-cache/src/zc/buildout/easy_install.py 2012-01-16 22:58:50 UTC (rev 124061)
@@ -1863,6 +1863,15 @@
return "Couldn't find a distribution for %r." % str(req)
def _log_requirement(ws, req):
+ if not logger.isEnabledFor(logging.DEBUG):
+ # Sorting the working set and iterating over it's requirements
+ # is expensive, so short cirtuit the work if it won't even be
+ # logged. When profiling a simple buildout with 10 parts with
+ # identical and large working sets, this resulted in a
+ # decrease of run time from 93.411 to 15.068 seconds, about a
+ # 6 fold improvement.
+ return
+
ws = list(ws)
ws.sort()
for dist in ws:
More information about the checkins
mailing list