[Groonga-commit] droonga/fluent-plugin-droonga at 6bb27ed [master] Benchmark: add subscribers and keywords in more faster way

Back to archive index

YUKI Hiroshi null+****@clear*****
Mon Oct 28 12:52:17 JST 2013


YUKI Hiroshi	2013-10-28 12:52:17 +0900 (Mon, 28 Oct 2013)

  New Revision: 6bb27ed8eeae03363f42c777ef81005c939aadb4
  https://github.com/droonga/fluent-plugin-droonga/commit/6bb27ed8eeae03363f42c777ef81005c939aadb4

  Message:
    Benchmark: add subscribers and keywords in more faster way

  Modified files:
    benchmark/utils.rb
    benchmark/watch/benchmark-scan.rb

  Modified: benchmark/utils.rb (+19 -0)
===================================================================
--- benchmark/utils.rb    2013-10-28 12:36:37 +0900 (378b329)
+++ benchmark/utils.rb    2013-10-28 12:52:17 +0900 (71daba6)
@@ -35,6 +35,25 @@ module DroongaBenchmark
       end
     end
 
+    def subscribe_to(terms)
+      @context.send("load --table Query")
+      @context.send("[")
+      terms.each do |term|
+        @context.send("{'_key':#{term}," +
+                        "'keywords':['#{term}']},")
+      end
+      @context.send("]")
+
+      @context.send("load --table Subscriber")
+      @context.send("[")
+      terms.each do |term|
+        @context.send("{'_key':'subscriber for #{term}'," +
+                        "'subscriptions':['#{term}']," +
+                        "'route':'0.0.0.0:0/benchamrk'},")
+      end
+      @context.send("]")
+    end
+
     def subscribe(term)
       queries = @context["Query"]
       query = queries.add(term, :keywords => [term])

  Modified: benchmark/watch/benchmark-scan.rb (+1 -3)
===================================================================
--- benchmark/watch/benchmark-scan.rb    2013-10-28 12:36:37 +0900 (8745a3d)
+++ benchmark/watch/benchmark-scan.rb    2013-10-28 12:52:17 +0900 (94b8797)
@@ -40,9 +40,7 @@ class ScanBenchmark
     @terms = @terms_generator.generate(@n_times)
     prepare_targets(@incidence)
 
-    @terms.each do |term|
-      @database.subscribe(term)
-    end
+    @database.subscribe_to(@terms)
     @n_terms =****@terms*****
 
     @hits = []
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index