[Checkins] SVN: zc.buildout/branches/1.4/ Avoid sorting the working set and requirements when it won't be logged.
Ross Patterson
me at rpatterson.net
Mon Jan 16 22:46:38 UTC 2012
Log message for revision 124060:
Avoid sorting the working set and requirements when it won't be logged.
Backport 124059 from trunk.
Changed:
U zc.buildout/branches/1.4/CHANGES.txt
U zc.buildout/branches/1.4/src/zc/buildout/easy_install.py
-=-
Modified: zc.buildout/branches/1.4/CHANGES.txt
===================================================================
--- zc.buildout/branches/1.4/CHANGES.txt 2012-01-16 22:32:59 UTC (rev 124059)
+++ zc.buildout/branches/1.4/CHANGES.txt 2012-01-16 22:46:38 UTC (rev 124060)
@@ -4,6 +4,13 @@
1.4.5 (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)
+
- Introduce a cache for the expensive `buildout._dir_hash` function.
- Remove duplicate path from script's sys.path setup.
Modified: zc.buildout/branches/1.4/src/zc/buildout/easy_install.py
===================================================================
--- zc.buildout/branches/1.4/src/zc/buildout/easy_install.py 2012-01-16 22:32:59 UTC (rev 124059)
+++ zc.buildout/branches/1.4/src/zc/buildout/easy_install.py 2012-01-16 22:46:38 UTC (rev 124060)
@@ -1200,6 +1200,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