Rev 2516: fix benchmark names, refactor to avoid 'create_path_names' overhead. in http://bzr.arbash-meinel.com/branches/bzr/0.17-dev/dirstate_pyrex
John Arbash Meinel
john at arbash-meinel.com
Mon May 7 19:09:13 BST 2007
At http://bzr.arbash-meinel.com/branches/bzr/0.17-dev/dirstate_pyrex
------------------------------------------------------------
revno: 2516
revision-id: john at arbash-meinel.com-20070507180840-e0r1jomaos7an93j
parent: john at arbash-meinel.com-20070507175701-b8c87exjybq31evq
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dirstate_pyrex
timestamp: Mon 2007-05-07 13:08:40 -0500
message:
fix benchmark names, refactor to avoid 'create_path_names' overhead.
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 17:57:01 +0000
+++ b/bzrlib/benchmarks/bench_dirstate.py 2007-05-07 18:08:40 +0000
@@ -96,13 +96,27 @@
finally:
state.unlock()
- def test__read_dirblocks_20k_tree_no_parents(self):
- state = self.build_20k_dirstate()
- state.lock_read()
- try:
- self.assertEqual(dirstate.DirState.NOT_IN_MEMORY,
- state._dirblock_state)
- self.time(state._read_dirblocks_if_needed)
+ def test__py_read_dirblocks_20k_tree_no_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()
+ self.time(dirstate._py_read_dirblocks, state)
+ finally:
+ state.unlock()
+
+ def test__c_read_dirblocks_20k_tree_no_parents(self):
+ self.requireFeature(CompiledDirstateHelpersFeature)
+ from bzrlib.compiled.dirstate_helpers import _c_read_dirblocks
+ state = self.build_20k_dirstate()
+ state.lock_read()
+ try:
+ self.assertEqual(dirstate.DirState.NOT_IN_MEMORY,
+ state._dirblock_state)
+ state._read_header_if_needed()
+ self.time(_c_read_dirblocks, state)
finally:
state.unlock()
@@ -242,17 +256,19 @@
Basically, compare every path in the list against every other path.
"""
paths = self.create_path_names(layout)
- for path1 in paths:
- for path2 in paths:
- cmp_func(path1, path2)
+ def compare_all():
+ for path1 in paths:
+ for path2 in paths:
+ cmp_func(path1, path2)
+ self.time(compare_all)
- def test_py_cmp_dirblock_strings(self):
+ def test_py_cmp_by_dirs(self):
"""Benchmark 103041 comparisons."""
- self.time(self.compareAllPaths, dirstate.py_cmp_by_dirs,
- [(3, 1), (3, 1), (3, 1), (3, 2)])
+ self.compareAllPaths(dirstate.py_cmp_by_dirs,
+ [(3, 1), (3, 1), (3, 1), (3, 2)])
- def test_c_cmp_dirblock_strings(self):
+ def test_c_cmp_by_dirs(self):
self.requireFeature(CompiledDirstateHelpersFeature)
from bzrlib.compiled.dirstate_helpers import c_cmp_by_dirs
- self.time(self.compareAllPaths, c_cmp_by_dirs,
- [(3, 1), (3, 1), (3, 1), (3, 2)])
+ self.compareAllPaths(c_cmp_by_dirs,
+ [(3, 1), (3, 1), (3, 1), (3, 2)])
More information about the bazaar-commits
mailing list