Skip to content

Instantly share code, notes, and snippets.

@k-yamada
Created June 24, 2012 00:18
Show Gist options
  • Save k-yamada/2980664 to your computer and use it in GitHub Desktop.
Save k-yamada/2980664 to your computer and use it in GitHub Desktop.
Benchmark of JRuby start-up time with arguments
require 'benchmark'
def test(args)
5.times do
`jruby test.rb #{args}`
end
end
Benchmark.bm(7) do |x|
x.report("default :") {test ""}
x.report("-X :") {test "-X"}
x.report("-D :") {test "-D"}
x.report("-32 :") {test "-32"}
x.report("-d32 :") {test "-d32"}
x.report("-X-D-32-d32 :") {test "-X-D-32-d32"}
end
require 'java'
puts "test"
$ ruby benchmark.rb
user system total real
default : 0.010000 0.010000 13.960000 ( 9.595538)
-X : 0.010000 0.010000 13.790000 ( 8.985453)
-D : 0.000000 0.010000 13.670000 ( 8.680449)
-32 : 0.000000 0.010000 13.280000 ( 8.599478)
-d32 : 0.010000 0.000000 6.670000 ( 5.797627)
-X-D-32-d32 : 0.000000 0.010000 13.710000 ( 8.736142)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment