Rev 3895: If we don't have content-length yet, then we need something for __len__. in http://bzr.arbash-meinel.com/branches/bzr/brisbane/lazy_gc_stream
John Arbash Meinel
john at arbash-meinel.com
Mon Mar 16 19:38:18 GMT 2009
At http://bzr.arbash-meinel.com/branches/bzr/brisbane/lazy_gc_stream
------------------------------------------------------------
revno: 3895
revision-id: john at arbash-meinel.com-20090316193117-a1irl7yqknd322rj
parent: john at arbash-meinel.com-20090316192106-iz7ccmx58s0ff3aa
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: lazy_gc_stream
timestamp: Mon 2009-03-16 14:31:17 -0500
message:
If we don't have content-length yet, then we need something for __len__.
This is, unfortunately, not a great answer, because the size will change with time.
And if you insert it into the LRUSizeCache, you'll get bad results out, because
at the time you insert, you'll only increment by X, but when you remove, you will
decrement by X+growth. We'll need a better answer eventually.
Anyway, this shows that we improve our 'ls -r-1' time from 10s => 5s, which is nice,
though XML does it in 1.0s...
-------------- next part --------------
=== modified file 'bzrlib/groupcompress.py'
--- a/bzrlib/groupcompress.py 2009-03-16 19:21:06 +0000
+++ b/bzrlib/groupcompress.py 2009-03-16 19:31:17 +0000
@@ -159,7 +159,15 @@
self._content = None
def __len__(self):
- return self._content_length + self._header_length
+ length = 0
+ if self._content_length is None:
+ length += self._z_content_length
+ if self._content is not None:
+ length += len(self._content)
+ else:
+ length += self._content_length
+ length += self._header_length
+ return length
def _parse_header(self):
"""Parse the header part of the block."""
More information about the bazaar-commits
mailing list