Skip to content
This repository was archived by the owner on Dec 28, 2023. It is now read-only.

Commit 5e1ce48

Browse files
Remove rufus and old AR support from benchmark script
Remove warning: `*' interpreted as argument prefix'`
1 parent 10c07ff commit 5e1ce48

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

benchmark/run.rb

+11-15
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
#! /usr/bin/ruby
1+
#!/usr/bin/ruby
22
$:.unshift File.expand_path('../../lib', __FILE__)
33

4+
require 'bundler/setup'
45
require 'i18n'
56
require 'benchmark'
67
require 'yaml'
78

8-
DATA_STORES = ARGV.delete("-ds")
99
N = (ARGV.shift || 1000).to_i
1010
YAML_HASH = YAML.load_file(File.expand_path("example.yml", File.dirname(__FILE__)))
1111

@@ -16,20 +16,16 @@ module Backends
1616
include I18n::Backend::InterpolationCompiler
1717
end.new
1818

19-
if DATA_STORES
20-
require 'rubygems'
21-
require File.expand_path('../../test/test_setup/active_record', __FILE__)
22-
require File.expand_path('../../test/test_setup/rufus_tokyo', __FILE__)
23-
24-
Test.setup_active_record
25-
ActiveRecord = I18n::Backend::ActiveRecord.new if defined?(::ActiveRecord)
26-
27-
Test.setup_rufus_tokyo
28-
TokyoCabinet = I18n::Backend::KeyValue.new(Rufus::Tokyo::Cabinet.new("*"), true) if defined?(::Rufus::Tokyo)
19+
begin
20+
require 'active_support'
21+
KeyValue = I18n::Backend::KeyValue.new({}, true)
22+
puts "Running KeyValue with ActiveSupport #{ActiveSupport::VERSION::STRING}"
23+
rescue LoadError
24+
puts 'Skipping KeyValue since ActiveSupport could not be loaded.'
2925
end
3026
end
3127

32-
ORDER = %w(Simple Interpolation ActiveRecord TokyoCabinet)
28+
ORDER = %w(Simple Interpolation KeyValue)
3329
ORDER.map!(&:to_sym) if RUBY_VERSION > '1.9'
3430

3531
module Benchmark
@@ -62,7 +58,7 @@ def self.measure_objects(n, &blk)
6258
puts "=> #{backend_name}\n\n"
6359

6460
Benchmark.rt "store", 1 do
65-
I18n.backend.store_translations *(YAML_HASH.to_a.first)
61+
I18n.backend.store_translations(*YAML_HASH.to_a.first)
6662
end
6763

6864
I18n.backend.translate :en, :first
@@ -114,4 +110,4 @@ def self.measure_objects(n, &blk)
114110
end
115111

116112
puts "Running memoized benchmarks with N = #{N}\n\n"
117-
(ORDER & Backends.constants).each(&benchmarker)
113+
(ORDER & Backends.constants).each(&benchmarker)

0 commit comments

Comments
 (0)