[Groonga-commit] droonga/fluent-plugin-droonga at 9f8249a [master] benchmark: add benchmark script for scan in watch

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Oct 24 18:40:56 JST 2013


Kouhei Sutou	2013-10-24 18:40:56 +0900 (Thu, 24 Oct 2013)

  New Revision: 9f8249a9abcb899081513761e990cb9098f7ba62
  https://github.com/droonga/fluent-plugin-droonga/commit/9f8249a9abcb899081513761e990cb9098f7ba62

  Message:
    benchmark: add benchmark script for scan in watch

  Added files:
    benchmark/benchmark-scan.rb
    benchmark/benchmark-watch-ddl.grn

  Added: benchmark/benchmark-scan.rb (+45 -0) 100644
===================================================================
--- /dev/null
+++ benchmark/benchmark-scan.rb    2013-10-24 18:40:56 +0900 (4134579)
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2013 droonga project
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1 as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# 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 "benchmark"
+
+require "groonga"
+
+require "droonga/plugin/handler_watch"
+
+class StubWorker
+  attr_reader :context
+  def initialize(context)
+    @context = context
+  end
+end
+
+Groonga::Database.open("/tmp/watch/db")
+
+worker = StubWorker.new(Groonga::Context.default)
+watch = Droonga::WatchHandler.new(worker)
+
+n = 100
+Benchmark.bmbm do |benchmark|
+  benchmark.report("") do
+    hits = []
+    n.times do
+      watch.send(:scan_body, hits, "This is a comment.")
+      hits.clear
+    end
+  end
+end

  Added: benchmark/benchmark-watch-ddl.grn (+11 -0) 100644
===================================================================
--- /dev/null
+++ benchmark/benchmark-watch-ddl.grn    2013-10-24 18:40:56 +0900 (676ff4b)
@@ -0,0 +1,11 @@
+table_create Keyword TABLE_PAT_KEY ShortText --normalizer NormalizerAuto
+
+table_create Query TABLE_PAT_KEY ShortText
+column_create Query keywords COLUMN_VECTOR Keyword
+
+column_create Keyword queries COLUMN_INDEX Query keywords
+
+load --table Query
+[
+{"_key": "This comment", "keywords": ["This", "comment"]}
+]
-------------- next part --------------
HTML����������������������������...
Download 



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