[Pkg-bazaar-commits] ./bzr/unstable r931: - experiment with making Weave._extract() return a list, not a generator - slightly faster

Martin Pool mbp at sourcefrog.net
Fri Apr 10 08:21:29 UTC 2009


------------------------------------------------------------
revno: 931
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Sun 2005-07-17 15:40:23 -0300
message:
  - experiment with making Weave._extract() return a list, not a generator - slightly faster
modified:
  bzrlib/weave.py
-------------- next part --------------
=== modified file 'bzrlib/weave.py'
--- a/bzrlib/weave.py	2005-07-17 18:27:05 +0000
+++ b/bzrlib/weave.py	2005-07-17 18:40:23 +0000
@@ -25,6 +25,9 @@
 # with intset (r926) 2000 versions in 93s !!!
 # better to just use plain sets.
 
+# making _extract build and return a list, rather than being a generator
+# takes 37.94s
+
 # TODO: Perhaps have copy method for Weave instances?
 
 # XXX: If we do weaves this way, will a merge still behave the same
@@ -365,6 +368,8 @@
 
         isactive = None
 
+        result = []
+
         WFE = WeaveFormatError
 
         for l in self._l:
@@ -391,7 +396,7 @@
                 if isactive is None:
                     isactive = (not dset) and istack and (istack[-1] in included)
                 if isactive:
-                    yield istack[-1], lineno, l
+                    result.append((istack[-1], lineno, l))
             lineno += 1
 
         if istack:
@@ -401,6 +406,9 @@
             raise WFE("unclosed deletion blocks at end of weave",
                                    dset)
 
+        return result
+    
+
 
     def get_iter(self, version):
         """Yield lines for the specified version."""



More information about the Pkg-bazaar-commits mailing list