Rev 2523: Add DirState.save() benchmarks. in http://bzr.arbash-meinel.com/branches/bzr/0.17-dev/dirstate_pyrex

John Arbash Meinel john at arbash-meinel.com
Mon May 7 22:19:04 BST 2007


At http://bzr.arbash-meinel.com/branches/bzr/0.17-dev/dirstate_pyrex

------------------------------------------------------------
revno: 2523
revision-id: john at arbash-meinel.com-20070507211832-430v0s9bvjud3jeg
parent: john at arbash-meinel.com-20070507204345-plq5j2u2hfwm1q8v
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dirstate_pyrex
timestamp: Mon 2007-05-07 16:18:32 -0500
message:
  Add DirState.save() benchmarks.
  At this point it doesn't seem a huge overhead
  (857ms for 20k entries with 2 parents on a slow machine)
  But something we might look into in the future
modified:
  bzrlib/benchmarks/bench_dirstate.py bench_dirstate.py-20070503203500-gs0pz6zkvjpq9l2x-1
-------------- next part --------------
=== modified file 'bzrlib/benchmarks/bench_dirstate.py'
--- a/bzrlib/benchmarks/bench_dirstate.py	2007-05-07 20:38:16 +0000
+++ b/bzrlib/benchmarks/bench_dirstate.py	2007-05-07 21:18:32 +0000
@@ -151,6 +151,42 @@
         finally:
             state.unlock()
 
+    def test_save_20k_tree_0_parents(self):
+        state = self.build_20k_dirstate()
+        state.lock_read()
+        try:
+            self.assertEqual(dirstate.DirState.NOT_IN_MEMORY,
+                             state._dirblock_state)
+            state._read_header_if_needed()
+            state._dirblock_state = dirstate.DirState.IN_MEMORY_MODIFIED
+            self.time(state.save)
+        finally:
+            state.unlock()
+
+    def test_save_20k_tree_1_parent(self):
+        state = self.build_20k_dirstate_with_parents(1)
+        state.lock_read()
+        try:
+            self.assertEqual(dirstate.DirState.NOT_IN_MEMORY,
+                             state._dirblock_state)
+            state._read_dirblocks_if_needed()
+            state._dirblock_state = dirstate.DirState.IN_MEMORY_MODIFIED
+            self.time(state.save)
+        finally:
+            state.unlock()
+
+    def test_save_20k_tree_2_parents(self):
+        state = self.build_20k_dirstate_with_parents(2)
+        state.lock_read()
+        try:
+            self.assertEqual(dirstate.DirState.NOT_IN_MEMORY,
+                             state._dirblock_state)
+            state._read_dirblocks_if_needed()
+            state._dirblock_state = dirstate.DirState.IN_MEMORY_MODIFIED
+            self.time(state.save)
+        finally:
+            state.unlock()
+
     def test__read_dirblocks_20k_tree_0_parents_py(self):
         state = self.build_20k_dirstate()
         state.lock_read()



More information about the bazaar-commits mailing list