Rev 4760: (jam) Some small tweaks for memory consumption of CHKInventory and in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Oct 21 00:25:39 BST 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4760 [merge]
revision-id: pqm at pqm.ubuntu.com-20091020232536-4azg7ofe3varsq2b
parent: pqm at pqm.ubuntu.com-20091020114259-xxou482wvh20lhl6
parent: john at arbash-meinel.com-20091020203021-xtusugq202e6qej7
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2009-10-21 00:25:36 +0100
message:
(jam) Some small tweaks for memory consumption of CHKInventory and
CHKMap.
modified:
bzrlib/chk_map.py chk_map.py-20081001014447-ue6kkuhofvdecvxa-1
bzrlib/inventory.py inventory.py-20050309040759-6648b84ca2005b37
=== modified file 'bzrlib/chk_map.py'
--- a/bzrlib/chk_map.py 2009-10-08 04:35:01 +0000
+++ b/bzrlib/chk_map.py 2009-10-20 20:30:21 +0000
@@ -83,6 +83,8 @@
class CHKMap(object):
"""A persistent map from string to string backed by a CHK store."""
+ __slots__ = ('_store', '_root_node', '_search_key_func')
+
def __init__(self, store, root_key, search_key_func=None):
"""Create a CHKMap object.
@@ -556,6 +558,10 @@
adding the header bytes, and without prefix compression.
"""
+ __slots__ = ('_key', '_len', '_maximum_size', '_key_width',
+ '_raw_size', '_items', '_search_prefix', '_search_key_func'
+ )
+
def __init__(self, key_width=1):
"""Create a node.
@@ -650,6 +656,8 @@
the key/value pairs.
"""
+ __slots__ = ('_common_serialised_prefix', '_serialise_key')
+
def __init__(self, search_key_func=None):
Node.__init__(self)
# All of the keys in this leaf node share this common prefix
@@ -947,6 +955,8 @@
LeafNode or InternalNode.
"""
+ __slots__ = ('_node_width',)
+
def __init__(self, prefix='', search_key_func=None):
Node.__init__(self)
# The size of an internalnode with default values and no children.
=== modified file 'bzrlib/inventory.py'
--- a/bzrlib/inventory.py 2009-10-14 13:47:28 +0000
+++ b/bzrlib/inventory.py 2009-10-20 20:29:11 +0000
@@ -1918,11 +1918,11 @@
raise errors.BzrError('Duplicate key in inventory: %r\n%r'
% (key, bytes))
info[key] = value
- revision_id = info['revision_id']
- root_id = info['root_id']
- search_key_name = info.get('search_key_name', 'plain')
- parent_id_basename_to_file_id = info.get(
- 'parent_id_basename_to_file_id', None)
+ revision_id = intern(info['revision_id'])
+ root_id = intern(info['root_id'])
+ search_key_name = intern(info.get('search_key_name', 'plain'))
+ parent_id_basename_to_file_id = intern(info.get(
+ 'parent_id_basename_to_file_id', None))
id_to_entry = info['id_to_entry']
result = CHKInventory(search_key_name)
More information about the bazaar-commits
mailing list