Remove rufus and old AR support from benchmark script

Remove warning: `*' interpreted as argument prefix'`
This commit is contained in:
Carlos Antonio da Silva 2014-05-09 11:02:03 -03:00
parent 10c07ff7d0
commit 5e1ce4841b
1 changed files with 11 additions and 15 deletions

View File

@ -1,11 +1,11 @@
#! /usr/bin/ruby
#!/usr/bin/ruby
$:.unshift File.expand_path('../../lib', __FILE__)
require 'bundler/setup'
require 'i18n'
require 'benchmark'
require 'yaml'
DATA_STORES = ARGV.delete("-ds")
N = (ARGV.shift || 1000).to_i
YAML_HASH = YAML.load_file(File.expand_path("example.yml", File.dirname(__FILE__)))
@ -16,20 +16,16 @@ module Backends
include I18n::Backend::InterpolationCompiler
end.new
if DATA_STORES
require 'rubygems'
require File.expand_path('../../test/test_setup/active_record', __FILE__)
require File.expand_path('../../test/test_setup/rufus_tokyo', __FILE__)
Test.setup_active_record
ActiveRecord = I18n::Backend::ActiveRecord.new if defined?(::ActiveRecord)
Test.setup_rufus_tokyo
TokyoCabinet = I18n::Backend::KeyValue.new(Rufus::Tokyo::Cabinet.new("*"), true) if defined?(::Rufus::Tokyo)
begin
require 'active_support'
KeyValue = I18n::Backend::KeyValue.new({}, true)
puts "Running KeyValue with ActiveSupport #{ActiveSupport::VERSION::STRING}"
rescue LoadError
puts 'Skipping KeyValue since ActiveSupport could not be loaded.'
end
end
ORDER = %w(Simple Interpolation ActiveRecord TokyoCabinet)
ORDER = %w(Simple Interpolation KeyValue)
ORDER.map!(&:to_sym) if RUBY_VERSION > '1.9'
module Benchmark
@ -62,7 +58,7 @@ benchmarker = lambda do |backend_name|
puts "=> #{backend_name}\n\n"
Benchmark.rt "store", 1 do
I18n.backend.store_translations *(YAML_HASH.to_a.first)
I18n.backend.store_translations(*YAML_HASH.to_a.first)
end
I18n.backend.translate :en, :first
@ -114,4 +110,4 @@ Backends.constants.each do |backend_name|
end
puts "Running memoized benchmarks with N = #{N}\n\n"
(ORDER & Backends.constants).each(&benchmarker)
(ORDER & Backends.constants).each(&benchmarker)