Rev 3726: Work around GraphIndex inefficiencies by requesting keys 1000 at a time. in http://bzr.arbash-meinel.com/branches/bzr/1.8-dev/lighter_log_file

John Arbash Meinel john at arbash-meinel.com
Fri Sep 19 04:42:25 BST 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.8-dev/lighter_log_file

------------------------------------------------------------
revno: 3726
revision-id: john at arbash-meinel.com-20080919034224-laq19nw522j3c6ge
parent: john at arbash-meinel.com-20080919032139-pdcuw9ryqatpqdn9
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: lighter_log_file
timestamp: Thu 2008-09-18 22:42:24 -0500
message:
  Work around GraphIndex inefficiencies by requesting keys 1000 at a time.
-------------- next part --------------
=== modified file 'bzrlib/log.py'
--- a/bzrlib/log.py	2008-09-19 03:21:39 +0000
+++ b/bzrlib/log.py	2008-09-19 03:42:24 +0000
@@ -562,12 +562,16 @@
     # Do a direct lookup of all possible text keys, and figure out which ones
     # are actually present, and then convert it back to revision_ids, since the
     # file_id prefix is shared by everything.
-    text_parent_map = branch.repository.texts.get_parent_map(text_keys)
     # Using a set of revisions instead of a set of keys saves about 1MB (out of
     # say 400). Not a huge deal, but still "better".
-    modified_text_revisions = set(key[1] for key in text_parent_map)
-    del text_parent_map
-    del text_keys
+    get_parent_map = branch.repository.texts.get_parent_map
+    modified_text_revisions = set()
+    chunk_size = 1000
+    for start in xrange(0, len(text_keys), chunk_size):
+        next_keys = text_keys[start:start + chunk_size]
+        modified_text_revisions.update(
+            [k[1] for k in get_parent_map(next_keys)])
+    del text_keys, next_keys
 
     result = []
     if direction == 'forward':



More information about the bazaar-commits mailing list