[Groonga-commit] droonga/fluent-plugin-droonga at 94cded8 [master] Benchmark: add watching terms in a robust and faster way

Back to archive index

YUKI Hiroshi null+****@clear*****
Mon Oct 28 14:32:23 JST 2013


YUKI Hiroshi	2013-10-28 14:32:23 +0900 (Mon, 28 Oct 2013)

  New Revision: 94cded80cc5b363999d9e0afc689b65594ba3048
  https://github.com/droonga/fluent-plugin-droonga/commit/94cded80cc5b363999d9e0afc689b65594ba3048

  Message:
    Benchmark: add watching terms in a robust and faster way

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

  Modified: benchmark/utils.rb (+6 -5)
===================================================================
--- benchmark/utils.rb    2013-10-28 13:36:02 +0900 (de1583c)
+++ benchmark/utils.rb    2013-10-28 14:32:23 +0900 (6d12af0)
@@ -15,6 +15,8 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
+require "json"
+
 module DroongaBenchmark
   class WatchDatabase
     attr_reader :context
@@ -35,11 +37,12 @@ module DroongaBenchmark
       end
     end
 
+=begin
     def subscribe_to(terms)
       @context.send("load --table Query")
       @context.send("[")
       terms.each do |term|
-        @context.send("{'_key':#{term}," +
+        @context.send("{'_key':'#{term}'," +
                         "'keywords':['#{term}']},")
       end
       @context.send("]")
@@ -53,10 +56,9 @@ module DroongaBenchmark
       end
       @context.send("]")
     end
+=end
 
-=begin
-# this is slower than above...
-    def subscribe_to_with_single_loop(terms)
+    def subscribe_to(terms)
       queries = []
       subscribers = []
       terms.each do |term|
@@ -79,7 +81,6 @@ module DroongaBenchmark
       @context.restore(command_load_queries.join("\n"))
       @context.restore(command_load_subscribers.join("\n"))
     end
-=end
 
     def subscribe(term)
       queries = @context["Query"]

  Modified: benchmark/watch/benchmark-scan.rb (+4 -1)
===================================================================
--- benchmark/watch/benchmark-scan.rb    2013-10-28 13:36:02 +0900 (89f67f3)
+++ benchmark/watch/benchmark-scan.rb    2013-10-28 14:32:23 +0900 (aa5967c)
@@ -60,9 +60,12 @@ class ScanBenchmark
   end
 
   def add_terms(n_terms)
+    new_terms = []
     n_terms.times do
-      @database.subscribe(@terms_generator.next)
+      new_terms << @terms_generator.next
     end
+    @database.subscribe_to(new_terms)
+    @terms += new_terms
     @n_terms += n_terms
   end
 
-------------- next part --------------
HTML����������������������������...
Download 



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