Rev 4784: as_st(items) saves about 800kB peak memory. in http://bazaar.launchpad.net/~jameinel/bzr/2.1-static-tuple-chk-map
John Arbash Meinel
john at arbash-meinel.com
Fri Oct 23 16:54:39 BST 2009
At http://bazaar.launchpad.net/~jameinel/bzr/2.1-static-tuple-chk-map
------------------------------------------------------------
revno: 4784
revision-id: john at arbash-meinel.com-20091023155427-7td5hrdhhyocsn6v
parent: john at arbash-meinel.com-20091023154601-2gg0gcbs3s5m90c3
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1-static-tuple-chk-map
timestamp: Fri 2009-10-23 10:54:27 -0500
message:
as_st(items) saves about 800kB peak memory.
Not huge, but possibly getting some stuff out of GC.
On the other hand, performance wise it looks like it costs 145s => 160s.
-------------- next part --------------
=== modified file 'bzrlib/chk_map.py'
--- a/bzrlib/chk_map.py 2009-10-23 15:36:54 +0000
+++ b/bzrlib/chk_map.py 2009-10-23 15:54:27 +0000
@@ -1489,6 +1489,7 @@
# this code. (We may want to evaluate saving the raw bytes into the
# page cache, which would allow a working tree update after the fetch
# to not have to read the bytes again.)
+ as_st = StaticTuple.from_sequence
stream = self._store.get_record_stream(keys, 'unordered', True)
for record in stream:
if self._pb is not None:
@@ -1505,6 +1506,8 @@
# The sha1 pointer (in this case the value), should
# already be a static tuple, and properly interned. So
# i'm not sure if there is a big win on top of that
+ # Also note that prefix_refs itself seems to be a pretty
+ # short lived list.
prefix_refs = node._items.items()
items = []
else:
@@ -1517,7 +1520,7 @@
# may not be an actual benefit to interning this tuple.
# The file_key should already be interned. If it isn't we
# need to look into it.
- items = node._items.items()
+ items = [as_st(item) for item in node._items.iteritems()]
yield record, node, prefix_refs, items
def _read_old_roots(self):
More information about the bazaar-commits
mailing list