Skip to content

Instantly share code, notes, and snippets.

@billdueber
Created December 19, 2011 16:51
Show Gist options
  • Save billdueber/1497941 to your computer and use it in GitHub Desktop.
Save billdueber/1497941 to your computer and use it in GitHub Desktop.
JRuby: #extend 10x slower in 1.7 w/OpenJDK 1.7?
module A
def a
end
end
class C
end
n = 100_000
require 'benchmark'
puts Benchmark.realtime {
n.times do
c = C.new.extend A
c.a
end
}
__END__
jruby 1.7.0.dev (ruby-1.8.7-p352) (2011-12-19 f404f75) (OpenJDK 64-Bit Server VM 1.7.0-u2-b21) [darwin-amd64-java]
*** 10.7369999885559 ***
jruby 1.6.5 (ruby-1.8.7-p330) (2011-10-25 9dcd388) (OpenJDK 64-Bit Server VM 1.7.0-u2-b21) [darwin-amd64-java]
1.64599990844727
jruby 1.6.5 (ruby-1.9.2-p136) (2011-10-25 9dcd388) (OpenJDK 64-Bit Server VM 1.7.0-u2-b21) [darwin-amd64-java]
1.4980001449585
jruby 1.7.0.dev (ruby-1.8.7-p352) (2011-12-19 f404f75) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_26) [darwin-x86_64-java]
1.39100003242493
jruby 1.6.5 (ruby-1.8.7-p330) (2011-10-25 9dcd388) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_26) [darwin-x86_64-java]
1.26300001144409
jruby 1.6.5 (ruby-1.9.2-p136) (2011-10-25 9dcd388) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_26) [darwin-x86_64-java]
1.55699992179871
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin9.8.0]
1.14297199249268
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0]
0.346896
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment