Rev 43: Expose bloom/nobloom as a different benchmark test in http://bzr.arbash-meinel.com/plugins/index2

John Arbash Meinel john at arbash-meinel.com
Wed Jul 16 16:04:02 BST 2008


At http://bzr.arbash-meinel.com/plugins/index2

------------------------------------------------------------
revno: 43
revision-id: john at arbash-meinel.com-20080716150353-alnnb5j6njppqmtv
parent: john at arbash-meinel.com-20080716140531-8tmbw4y6vrjlxwfx
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: index2
timestamp: Wed 2008-07-16 10:03:53 -0500
message:
  Expose bloom/nobloom as a different benchmark test
  This way, we are sure we are testing with the same random keys.
  Also, pushd the 'text' fixture down so it can be profiled.
-------------- next part --------------
=== modified file 'indexbench.py'
--- a/indexbench.py	2008-07-16 13:20:23 +0000
+++ b/indexbench.py	2008-07-16 15:03:53 +0000
@@ -142,15 +142,7 @@
         text_index = CombinedGraphIndex(text_indices)
         reset_hit_counts()
         drop_cache()
-        now = time.time()
-        # VersionedFiles can do multi-key extraction, so we can use that.
-        
-        index = _KnitGraphIndex(text_index, lambda:True, deltas=True, parents=True)
-        vf = KnitVersionedFiles(index, None)
-        vf._get_components_positions(text_keys)
-        finish = time.time()
-        print "%s: get_components_positions(%d) in %0.3f, %s" % (label, len(text_keys),
-            finish - now, hits())
+        run(label, 'text', get_text, label, text_index, text_keys)
 # follow a revision graph
     if 'revision' in fixtures:
         test_ancestry = run(label, 'revision', revision_search, label,
@@ -199,6 +191,18 @@
     print "%s: %s in %0.3f,%s" % (label, fixture_label, finish - now, hits())
 
 
+def get_text(label, text_index, text_keys):
+        now = time.time()
+        # VersionedFiles can do multi-key extraction, so we can use that.
+        
+        index = _KnitGraphIndex(text_index, lambda:True, deltas=True, parents=True)
+        vf = KnitVersionedFiles(index, None)
+        vf._get_components_positions(text_keys)
+        finish = time.time()
+        print "%s: get_components_positions(%d) in %0.3f, %s" % (label, len(text_keys),
+            finish - now, hits())
+
+
 def revision_search(label, drop_cache, names, target, factory, tip_revision_id):
     rev_names = [name for name in names if name.endswith('.rix')]
     # reopen indices
@@ -252,6 +256,7 @@
     takes_options = [
         Option('graph', help='bench the GraphIndex class'),
         Option('btree', help='bench the BTreeGraphIndex class'),
+        Option('btree-bloom', help='bench the BTreeGraphIndex class using bloom'),
         Option('drop-cache', help='drop caches between fixtures'),
         ListOption('fixture', type=str,
             help='fixtures to test: one of all, shuffle, text, revision, miss, '
@@ -266,7 +271,8 @@
 
     takes_args = ['sample_branch']
 
-    def run(self, sample_branch, graph=True, btree=True, drop_cache=False,
+    def run(self, sample_branch, graph=True, btree=True, btree_bloom=True,
+            drop_cache=False,
             fixture=None, lspro=False, calltree=True, test_area=None):
         if not fixture:
             fixture = ['all', 'shuffle', 'text', 'revision', 'miss', 'random_reload']
@@ -309,10 +315,15 @@
             test_transport = get_transport(test_area)
 
         if btree:
-            print 'Using blooms: %s' % (BTreeGraphIndex._default_use_blooms,)
+            BTreeGraphIndex._default_use_blooms = False
             self.test_class(names, source, BTreeGraphIndex, BTreeBuilder,
                 'BTreeIndex', name_keys, text_keys, drop_cache, fixture, lspro,
                 tip_revision_id, ancestry, test_transport)
+        if btree_bloom:
+            BTreeGraphIndex._default_use_blooms = True
+            self.test_class(names, source, BTreeGraphIndex, BTreeBuilder,
+                'BTreeIndex_bloom', name_keys, text_keys, drop_cache, fixture,
+                lspro, tip_revision_id, ancestry, test_transport)
         if graph:
             self.test_class(names, source, GraphIndex, GraphIndexBuilder,
                 'GraphIndex', name_keys, text_keys, drop_cache, fixture, lspro,



More information about the bazaar-commits mailing list