Rev 3721: Document some other alternatives, but in the end, just go with the memory consuming fast 'frozenset()' in http://bzr.arbash-meinel.com/branches/bzr/1.8-dev/lighter_log_file

John Arbash Meinel john at arbash-meinel.com
Thu Sep 18 21:03:17 BST 2008


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

------------------------------------------------------------
revno: 3721
revision-id: john at arbash-meinel.com-20080918200316-v76fi3cotgu3qfun
parent: john at arbash-meinel.com-20080918193947-0nbfx6f2yu3zvi3k
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: lighter_log_file
timestamp: Thu 2008-09-18 15:03:16 -0500
message:
  Document some other alternatives, but in the end, just go with the memory consuming fast 'frozenset()'
-------------- next part --------------
=== modified file 'bzrlib/log.py'
--- a/bzrlib/log.py	2008-09-18 19:39:47 +0000
+++ b/bzrlib/log.py	2008-09-18 20:03:16 +0000
@@ -644,6 +644,17 @@
         elif isinstance(rev_ancestry, list):
             # We can use "tuple()" here to save memory at the cost of CPU, or
             # use frozenset() which saves CPU but consumes RAM.
+            # We can also 'switch' based on the length of the ancestry.
+            # That gives the most direct control over memory versus CPU.
+            # For now, just going with the more performant frozenset()
+            # Also, note that both tuple and frozenset just reference the
+            # passed in object if they are of the same type. (Unlike list and
+            # set which create a new copy.)
+            #  if isinstance(x, tuple):
+            #    assert x is tuple(x)
+            # You have the same:
+            #  if isinstance(y, frozenset):
+            #    assert y is frozenset(y)
             rev_ancestry = frozenset(rev_ancestry)
         ancestry_values[rev] = rev_ancestry
 



More information about the bazaar-commits mailing list