Skip to content

Instantly share code, notes, and snippets.

@francescoagati
Created October 23, 2012 10:08
Show Gist options
  • Save francescoagati/3938014 to your computer and use it in GitHub Desktop.
Save francescoagati/3938014 to your computer and use it in GitHub Desktop.
simple benchmarking jruby
rvm use 1.9.3
ruby bn.rb
Rehearsal --------------------------------------------
Hash:set 7.970000 0.030000 8.000000 ( 8.049540)
----------------------------------- total: 8.000000sec
user system total real
Hash:set 7.910000 0.030000 7.940000 ( 7.998218)
rvm use jruby 1.7.0
ruby -Xcompile.invokedynamic=true --server -J-Xmx2048m -J-Xms2048m -J-Xmn512m -J-XX:MaxPermSize=512m bn.rb
Rehearsal --------------------------------------------
Hash:set 2.380000 0.150000 2.530000 ( 1.614000)
----------------------------------- total: 2.530000sec
user system total real
Hash:set 1.510000 0.010000 1.520000 ( 0.990000)
require "benchmark"
Benchmark::bmbm do |x|
x.report("Hash:set") do
(0...1000000).map {|n| (n + 1000).to_s.gsub("0","1000").to_i }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment