[Pkg-bazaar-commits] ./bzr/unstable r148: performance notes and measurements

mbp at sourcefrog.net mbp at sourcefrog.net
Fri Apr 10 07:51:03 UTC 2009


------------------------------------------------------------
revno: 148
committer: mbp at sourcefrog.net
timestamp: Tue 2005-03-29 21:49:50 +1000
message:
  performance notes and measurements
modified:
  bzrlib/commands.py
  notes/performance.txt
-------------- next part --------------
=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py	2005-03-29 08:03:40 +0000
+++ b/bzrlib/commands.py	2005-03-29 11:49:50 +0000
@@ -359,6 +359,18 @@
                 print '%-50s %s' % (path, ie.file_id)
             else:
                 print path
+
+
+
+def cmd_parse_inventory():
+    import cElementTree
+    
+    cElementTree.ElementTree().parse(file('.bzr/inventory'))
+
+
+
+def cmd_load_inventory():
+    inv = Branch('.').read_working_inventory()
                 
     
 

=== modified file 'notes/performance.txt'
--- a/notes/performance.txt	2005-03-29 06:58:11 +0000
+++ b/notes/performance.txt	2005-03-29 11:49:50 +0000
@@ -296,5 +296,17 @@
 
 small but significant improvement from Python -O
 
-
-
+----
+
+Loading a large inventory through cElementTree is pretty quick; only
+about 0.117s.  By contrast reading the inventory into our data
+structure takes about 0.7s.  
+
+So I think the problem must be in converting everything to
+InventoryEntries and back again every time.
+
+Thought about that way it seems pretty inefficient: why create all
+those objects when most of them aren't called on most invocations?
+Instead perhaps the Inventory object should hold the ElementTree and
+pull things out of it only as necessary?  We can even have an index
+pointing into the ElementTree by id, path, etc.



More information about the Pkg-bazaar-commits mailing list