[Pkg-bazaar-commits] ./bzr/unstable r955: - use __slots__ on InventoryEntry; rather faster

Martin Pool mbp at sourcefrog.net
Fri Apr 10 08:13:35 UTC 2009


------------------------------------------------------------
revno: 955
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Fri 2005-07-22 16:32:46 -0300
message:
  - use __slots__ on InventoryEntry; rather faster
modified:
  bzrlib/inventory.py
-------------- next part --------------
=== modified file 'bzrlib/inventory.py'
--- a/bzrlib/inventory.py	2005-07-15 23:35:18 +0000
+++ b/bzrlib/inventory.py	2005-07-22 19:32:46 +0000
@@ -92,9 +92,9 @@
     # TODO: split InventoryEntry into subclasses for files,
     # directories, etc etc.
 
-    text_sha1 = None
-    text_size = None
-    
+    __slots__ = ['text_sha1', 'text_size', 'file_id', 'name', 'kind',
+                 'text_id', 'parent_id', 'children', ]
+
     def __init__(self, file_id, name, kind, parent_id, text_id=None):
         """Create an InventoryEntry
         
@@ -113,6 +113,9 @@
         if '/' in name or '\\' in name:
             raise BzrCheckError('InventoryEntry name %r is invalid' % name)
         
+        self.text_sha1 = None
+        self.text_size = None
+    
         self.file_id = file_id
         self.name = name
         self.kind = kind



More information about the Pkg-bazaar-commits mailing list