[Groonga-commit] ranguba/rroonga at f342a19 [master] benchmark: fix style

Back to archive index

Masafumi Yokoyama null+****@clear*****
Sat Nov 1 18:00:24 JST 2014


Masafumi Yokoyama	2014-11-01 18:00:24 +0900 (Sat, 01 Nov 2014)

  New Revision: f342a19175fca77bcada8dc20c7a811207dd3cd6
  https://github.com/ranguba/rroonga/commit/f342a19175fca77bcada8dc20c7a811207dd3cd6

  Message:
    benchmark: fix style

  Modified files:
    benchmark/common.rb
    benchmark/create-wikipedia-database.rb
    benchmark/read-write-many-small-items.rb
    benchmark/repeat-load.rb
    benchmark/select.rb
    benchmark/write-many-small-items.rb

  Modified: benchmark/common.rb (+4 -4)
===================================================================
--- benchmark/common.rb    2014-11-01 17:39:13 +0900 (f61dace)
+++ benchmark/common.rb    2014-11-01 18:00:24 +0900 (fa5b70a)
@@ -1,7 +1,7 @@
-require 'benchmark'
-require 'tempfile'
+require "benchmark"
+require "tempfile"
 
-def memory_usage()
+def memory_usage
   status = `cat /proc/#{$$}/status`
   lines = status.split("\n")
   lines.each do |line|
@@ -10,7 +10,7 @@ def memory_usage()
       return line.to_i / 1024.0
     end
   end
-  return -1;
+  return -1
 end
 
 @items = []

  Modified: benchmark/create-wikipedia-database.rb (+5 -5)
===================================================================
--- benchmark/create-wikipedia-database.rb    2014-11-01 17:39:13 +0900 (8e55b1b)
+++ benchmark/create-wikipedia-database.rb    2014-11-01 18:00:24 +0900 (b000583)
@@ -1,10 +1,10 @@
 # Wikipedia data: http://download.wikimedia.org/jawiki/latest/jawiki-latest-pages-articles.xml.bz2
 
-require 'time'
-require 'fileutils'
-require 'groonga'
+require "time"
+require "fileutils"
+require "groonga"
 
-require 'nokogiri'
+require "nokogiri"
 
 class WikipediaExtractor
   def initialize(listener)
@@ -200,7 +200,7 @@ class GroongaLoader
   def load_links(title, content)
     links = content.scan(/\[\[.*?\]\]/)
     links = links.collect do |link|
-      link.sub(/\A\[\[/, '').sub(/\]\]\z/, '').sub(/\|[^\|]+\z/, '')
+      link.sub(/\A\[\[/, "").sub(/\]\]\z/, "").sub(/\|[^\|]+\z/, "")
     end
     @documents.add(title, :links => links)
   end

  Modified: benchmark/read-write-many-small-items.rb (+7 -7)
===================================================================
--- benchmark/read-write-many-small-items.rb    2014-11-01 17:39:13 +0900 (c1b95bb)
+++ benchmark/read-write-many-small-items.rb    2014-11-01 18:00:24 +0900 (c136fcf)
@@ -52,7 +52,7 @@ begin
   $LOAD_PATH.unshift(File.join(base_dir, "ext", "groonga"))
   $LOAD_PATH.unshift(File.join(base_dir, "lib"))
 
-  require 'groonga'
+  require "groonga"
   tmp_dir = "/tmp/groonga"
   FileUtils.rm_rf(tmp_dir)
   FileUtils.mkdir(tmp_dir)
@@ -93,7 +93,7 @@ rescue LoadError
 end
 
 begin
-  require 'localmemcache'
+  require "localmemcache"
 
   LocalMemCache.drop(:namespace => "read-write-many-small-items",
                      :force => true)
@@ -108,9 +108,9 @@ rescue LoadError
 end
 
 begin
-  require 'tokyocabinet'
+  require "tokyocabinet"
 
-  tc_hash_memory = TokyoCabinet::ADB::new
+  tc_hash_memory = TokyoCabinet::ADB.new
   tc_hash_memory.open("*#bnum=#{n}#mode=wct#xmsiz=0")
   item("TC: Hash: memory") do
     values.each do |value|
@@ -119,7 +119,7 @@ begin
     end
   end
 
-  tc_tree_memory = TokyoCabinet::ADB::new
+  tc_tree_memory = TokyoCabinet::ADB.new
   tc_tree_memory.open("+#bnum=#{n}#mode=wct#xmsiz=0")
   item("TC: Tree: memory") do
     values.each do |value|
@@ -129,7 +129,7 @@ begin
   end
 
   hash_file = Tempfile.new(["tc-hash", ".tch"])
-  tc_hash_file = TokyoCabinet::ADB::new
+  tc_hash_file = TokyoCabinet::ADB.new
   tc_hash_file.open("#{hash_file.path}#bnum=#{n}#mode=wct#xmsiz=0")
   item("TC: Hash: file") do
     values.each do |value|
@@ -139,7 +139,7 @@ begin
   end
 
   tree_file = Tempfile.new(["tc-tree", ".tcb"])
-  tc_tree_file = TokyoCabinet::ADB::new
+  tc_tree_file = TokyoCabinet::ADB.new
   tc_tree_file.open("#{tree_file.path}#bnum=#{n}#mode=wct#xmsiz=0")
   item("TC: Tree: file") do
     values.each do |value|

  Modified: benchmark/repeat-load.rb (+4 -4)
===================================================================
--- benchmark/repeat-load.rb    2014-11-01 17:39:13 +0900 (b3431d6)
+++ benchmark/repeat-load.rb    2014-11-01 18:00:24 +0900 (225719d)
@@ -1,10 +1,10 @@
-require 'fileutils'
-require 'shellwords'
+require "fileutils"
+require "shellwords"
 
-require 'groonga'
+require "groonga"
 
 $LOAD_PATH.unshift(File.dirname(__FILE__))
-require 'create-wikipedia-database'
+require "create-wikipedia-database"
 
 class SampleRecords
   def initialize(record_count)

  Modified: benchmark/select.rb (+9 -9)
===================================================================
--- benchmark/select.rb    2014-11-01 17:39:13 +0900 (4fbef31)
+++ benchmark/select.rb    2014-11-01 18:00:24 +0900 (c1e74e6)
@@ -1,10 +1,10 @@
-#encoding: UTF-8
+# -*- coding: utf-8 -*-
 
-require 'benchmark'
-require 'shellwords'
-require 'optparse'
+require "benchmark"
+require "shellwords"
+require "optparse"
 
-require 'groonga'
+require "groonga"
 
 Groonga::Logger.query_log_path = "/tmp/query.log"
 
@@ -17,7 +17,7 @@ module ColumnTokenizer
     end
     tokens.each do |token|
       unless token == "*"
-        token.sub!(/[^A-Za-z0-9_]\z/, '')
+        token.sub!(/[^A-Za-z0-9_]\z/, "")
       end
     end
   end
@@ -217,7 +217,7 @@ class Query
     end
 
     def to_parameter_symbol(name)
-      name.sub(NAMED_PARAMETER_PREFIX, '').to_sym
+      name.sub(NAMED_PARAMETER_PREFIX, "").to_sym
     end
 
     def create_query
@@ -383,7 +383,7 @@ class SelectorByMethod < Selector
     tokens = tokenize_column_list(sort_by)
 
     tokens.collect do |token|
-      key = token.sub(DESCENDING_ORDER_PREFIX, '')
+      key = token.sub(DESCENDING_ORDER_PREFIX, "")
       if token =~ DESCENDING_ORDER_PREFIX
         descending_order_sort_key(key)
       else
@@ -493,7 +493,7 @@ class SelectorByMethod < Selector
     columns = columns.collect do |column|
       if column == "*"
         table.columns.collect(&:name).collect do |name|
-          name.sub(/\A[A-Za-z0-9_]+\./, '')
+          name.sub(/\A[A-Za-z0-9_]+\./, "")
         end
       else
         column if column_included_in_record?(column, result.first)

  Modified: benchmark/write-many-small-items.rb (+7 -7)
===================================================================
--- benchmark/write-many-small-items.rb    2014-11-01 17:39:13 +0900 (d7b36d1)
+++ benchmark/write-many-small-items.rb    2014-11-01 18:00:24 +0900 (57e26c2)
@@ -51,7 +51,7 @@ begin
   $LOAD_PATH.unshift(File.join(base_dir, "ext", "groonga"))
   $LOAD_PATH.unshift(File.join(base_dir, "lib"))
 
-  require 'groonga'
+  require "groonga"
   tmp_dir = "/tmp/groonga"
   FileUtils.rm_rf(tmp_dir)
   FileUtils.mkdir(tmp_dir)
@@ -89,7 +89,7 @@ rescue LoadError
 end
 
 begin
-  require 'localmemcache'
+  require "localmemcache"
 
   LocalMemCache.drop(:namespace => "write-many-small-items", :force => true)
   mem_cache = LocalMemCache.new(:namespace => "write-many-small-items")
@@ -102,9 +102,9 @@ rescue LoadError
 end
 
 begin
-  require 'tokyocabinet'
+  require "tokyocabinet"
 
-  tc_hash_memory = TokyoCabinet::ADB::new
+  tc_hash_memory = TokyoCabinet::ADB.new
   tc_hash_memory.open("*#bnum=#{n}#mode=wct#xmsiz=0")
   item("TC: Hash: memory") do
     values.each do |value|
@@ -112,7 +112,7 @@ begin
     end
   end
 
-  tc_tree_memory = TokyoCabinet::ADB::new
+  tc_tree_memory = TokyoCabinet::ADB.new
   tc_tree_memory.open("+#bnum=#{n}#mode=wct#xmsiz=0")
   item("TC: Tree: memory") do
     values.each do |value|
@@ -121,7 +121,7 @@ begin
   end
 
   hash_file = Tempfile.new(["tc-hash", ".tch"])
-  tc_hash_file = TokyoCabinet::ADB::new
+  tc_hash_file = TokyoCabinet::ADB.new
   tc_hash_file.open("#{hash_file.path}#bnum=#{n}#mode=wct#xmsiz=0")
   item("TC: Hash: file") do
     values.each do |value|
@@ -130,7 +130,7 @@ begin
   end
 
   tree_file = Tempfile.new(["tc-tree", ".tcb"])
-  tc_tree_file = TokyoCabinet::ADB::new
+  tc_tree_file = TokyoCabinet::ADB.new
   tc_tree_file.open("#{tree_file.path}#bnum=#{n}#mode=wct#xmsiz=0")
   item("TC: Tree: file") do
     values.each do |value|
-------------- next part --------------
HTML����������������������������...
下載 



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