[Groonga-commit] droonga/fluent-plugin-droonga at 774550d [master] Benchmark: generate random terms with different initial letters

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Oct 24 17:41:59 JST 2013


YUKI Hiroshi	2013-10-24 17:41:59 +0900 (Thu, 24 Oct 2013)

  New Revision: 774550d1bbe811a0c3610772dbb27e3541c5d122
  https://github.com/droonga/fluent-plugin-droonga/commit/774550d1bbe811a0c3610772dbb27e3541c5d122

  Message:
    Benchmark: generate random terms with different initial letters

  Added files:
    benchmark/benchmark.rb

  Added: benchmark/benchmark.rb (+39 -0) 100644
===================================================================
--- /dev/null
+++ benchmark/benchmark.rb    2013-10-24 17:41:59 +0900 (b6b823b)
@@ -0,0 +1,39 @@
+# -*- 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
+
+class Benchmark
+  class TermsList
+    class << self
+      def terms
+        new.to_enum(:terms)
+      end
+    end
+
+    FIRST_INITIAL_LETTER = "㐀"
+    def terms
+      initial_letter = FIRST_INITIAL_LETTER
+      while true do
+        yield "#{initial_letter}#{random_term}"
+        initial_letter.succ!
+      end
+    end
+
+    def random_term
+      (("a".."z").to_a + ("A".."Z").to_a + (0..9).to_a).shuffle[0..7].join
+    end
+  end
+end
-------------- next part --------------
HTML����������������������������...
Download 



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