[Groonga-commit] ranguba/rroonga at 7ae7fcf [master] travis: run benchmark script for #16 on Travis CI

Back to archive index

Kouhei Sutou null+****@clear*****
Sun May 4 22:47:12 JST 2014


Kouhei Sutou	2014-05-04 22:47:12 +0900 (Sun, 04 May 2014)

  New Revision: 7ae7fcf1712f992a183321e80c7900d7735921b8
  https://github.com/ranguba/rroonga/commit/7ae7fcf1712f992a183321e80c7900d7735921b8

  Message:
    travis: run benchmark script for #16 on Travis CI
    
    It will be reverted soon.

  Added files:
    run-benchmark.sh
  Modified files:
    .travis.yml

  Modified: .travis.yml (+2 -0)
===================================================================
--- .travis.yml    2014-05-04 22:44:52 +0900 (a687229)
+++ .travis.yml    2014-05-04 22:47:12 +0900 (3001938)
@@ -12,3 +12,5 @@ rvm:
 #     - rvm: 2.1.0
 before_install:
   - curl --silent --location https://github.com/groonga/groonga/raw/master/data/travis/setup.sh | sh
+after_script:
+  - ./run-benchmark.sh

  Added: run-benchmark.sh (+51 -0) 100755
===================================================================
--- /dev/null
+++ run-benchmark.sh    2014-05-04 22:47:12 +0900 (35f3a6f)
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+cat <<EOF > column-benchmark.rb
+# -*- coding: utf-8 -*-
+require 'benchmark'
+require 'groonga'
+
+def measure(try)
+  n = 50000
+
+  puts try
+  table = Groonga[:Test]
+  Benchmark.bm(12) do |x|
+    x.report('empty loop') do
+      n.times { }
+    end
+    x.report('column:') do
+      n.times { table.column('col') }
+    end
+    x.report('columns:') do
+      n.times { table.columns('col') }
+    end
+    x.report('have_column?') do
+      n.times { table.have_column?('col') }
+    end
+  end
+end
+
+path = './test-table-column.db'
+database = Groonga::Database.create(:path => path)
+table = Groonga::Array.create(:name => 'Test')
+table.define_column('col', 'ShortText')
+
+puts 'immediate after column created'
+measure '1st'
+measure '2nd'
+
+puts '----'
+
+database.close
+database = Groonga::Database.open(path)
+
+puts 'after close/open'
+measure '1st'
+measure '2nd'
+
+table.remove
+database.remove
+EOF
+
+ruby column-benchmark.rb
-------------- next part --------------
HTML����������������������������...
다운로드 



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