Skip to content

Instantly share code, notes, and snippets.

@joshbuddy
Created May 28, 2009 04:30
Show Gist options
  • Save joshbuddy/119092 to your computer and use it in GitHub Desktop.
Save joshbuddy/119092 to your computer and use it in GitHub Desktop.
old-stumpy:Documents josh$ ruby test.rb
with create_additions
4.270000 0.030000 4.300000 ( 4.348951)
4.270000 0.020000 4.290000 ( 4.353974)
4.270000 0.030000 4.300000 ( 4.337681)
4.280000 0.020000 4.300000 ( 4.316854)
4.270000 0.020000 4.290000 ( 4.325486)
without create_additions
4.210000 0.030000 4.240000 ( 4.284506)
4.210000 0.030000 4.240000 ( 4.266183)
4.190000 0.020000 4.210000 ( 4.238301)
4.200000 0.020000 4.220000 ( 4.266606)
4.210000 0.030000 4.240000 ( 4.278013)
old-stumpy:Documents josh$ ruby19 test.rb
with create_additions
3.820000 0.030000 3.850000 ( 3.899758)
3.800000 0.020000 3.820000 ( 3.831079)
3.790000 0.020000 3.810000 ( 3.819608)
3.810000 0.020000 3.830000 ( 3.850160)
3.800000 0.020000 3.820000 ( 3.839624)
without create_additions
3.720000 0.020000 3.740000 ( 3.752126)
3.730000 0.020000 3.750000 ( 3.809361)
3.730000 0.020000 3.750000 ( 3.776262)
3.730000 0.020000 3.750000 ( 3.775406)
3.730000 0.030000 3.760000 ( 3.778130)
old-stumpy:Documents josh$ jruby test.rb
with create_additions
4.717000 0.000000 4.717000 ( 4.717000)
4.608000 0.000000 4.608000 ( 4.607000)
4.593000 0.000000 4.593000 ( 4.593000)
4.619000 0.000000 4.619000 ( 4.619000)
4.604000 0.000000 4.604000 ( 4.604000)
without create_additions
4.515000 0.000000 4.515000 ( 4.515000)
4.503000 0.000000 4.503000 ( 4.503000)
4.480000 0.000000 4.480000 ( 4.480000)
4.501000 0.000000 4.501000 ( 4.501000)
4.503000 0.000000 4.503000 ( 4.503000)
======
require 'benchmark'
require 'rubygems'
require 'json'
json = '[{"test" : "test", "test" : "test", "test" : "test", "test" : "test", "test" : "test", "test" : "test", "test" : "test", "test" : "test"},{"test" : "test", "test" : "test", "test" : "test", "test" : "test", "test" : "test", "test" : "test", "test" : "test", "test" : "test"},{"test" : "test", "test" : "test", "test" : "test", "test" : "test", "test" : "test", "test" : "test", "test" : "test", "test" : "test"},{"test" : "test", "test" : "test", "test" : "test", "test" : "test", "test" : "test", "test" : "test", "test" : "test", "test" : "test"},{"test" : "test", "test" : "test", "test" : "test", "test" : "test", "test" : "test", "test" : "test", "test" : "test", "test" : "test"}]'
puts "with create_additions"
5.times do
puts Benchmark.measure {
50_000.times {JSON.parse(json, :create_additions => true)}
}
end
puts "without create_additions"
5.times do
puts Benchmark.measure {
50_000.times {JSON.parse(json, :create_additions => false)}
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment