Created
May 1, 2010 13:12
-
-
Save thedarkone/386319 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -wKU | |
puts RUBY_DESCRIPTION | |
$:.unshift File.expand_path("../lib", File.dirname(__FILE__)) | |
require 'i18n' | |
require 'benchmark' | |
require 'yaml' | |
str = "This is a custom blank message for {{model}}: {{attribute}}" | |
str19 = "This is a custom blank message for %{model}: %{attribute}" | |
I18n::Backend::InterpolationCompiler::Compiler.compile_if_an_interpolation(str) | |
keys = {:model => 'MODEL', :attribute => 'ATTRIBUTE'} | |
TESTS = (ARGV.shift || 5_000_000).to_i | |
Benchmark.bmbm do |results| | |
results.report('compiler') do | |
TESTS.times { str.i18n_interpolate(keys) } | |
end | |
results.report('1.9') do | |
TESTS.times { str19 % keys } | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby 1.9.2dev (2010-04-27 trunk 27512) [x86_64-darwin10.2.0] | |
Rehearsal -------------------------------------------- | |
compiler 6.710000 0.040000 6.750000 ( 6.775250) | |
1.9 7.340000 0.100000 7.440000 ( 7.471159) | |
---------------------------------- total: 14.190000sec | |
user system total real | |
compiler 6.690000 0.020000 6.710000 ( 6.718618) | |
1.9 7.350000 0.110000 7.460000 ( 7.513237) | |
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.2.0], MBARI 0x6770, Ruby Enterprise Edition 2009.10 | |
Rehearsal -------------------------------------------- | |
compiler 6.620000 0.080000 6.700000 ( 6.776867) | |
1.9 38.540000 0.030000 38.570000 ( 38.771854) | |
---------------------------------- total: 45.270000sec | |
user system total real | |
compiler 6.650000 0.090000 6.740000 ( 6.866077) | |
1.9 38.680000 0.060000 38.740000 ( 39.019099) | |
jruby 1.5.0.RC1 (ruby 1.8.7 patchlevel 249) (2010-04-14 0b08bc7) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_17) [x86_64-java] | |
Rehearsal -------------------------------------------- | |
compiler 2.733000 0.000000 2.733000 ( 2.637000) | |
1.9 15.262000 0.000000 15.262000 ( 15.262000) | |
---------------------------------- total: 17.995000sec | |
user system total real | |
compiler 2.721000 0.000000 2.721000 ( 2.721000) | |
1.9 15.819000 0.000000 15.819000 ( 15.819000) | |
rubinius 1.0.0-rc4 (1.8.7 release 2010-03-31 JI) [x86_64-apple-darwin10.2.0] | |
Rehearsal -------------------------------------------- | |
compiler 4.835470 0.000000 4.835470 ( 4.835480) | |
1.9 66.769281 0.000000 66.769281 ( 66.769300) | |
---------------------------------- total: 71.604751sec | |
user system total real | |
compiler 4.444365 0.000000 4.444365 ( 4.444395) | |
1.9 65.180435 0.000000 65.180435 ( 65.180447) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment