Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add autoload benchmark script.

Constant lookup&store should not be affected as far as no autoload
defined because autoload-threadsafe branch only adds logic after UNDEF
check.

For autoload, there's no perf drop.

% JAVA_HOME=/home/nahi/java/jdk1.6.0_26 jruby -v autoload/bench_autoload.rb
jruby 1.7.0.dev (ruby-1.8.7-p330) (2011-07-12 4d1b64e) (Java HotSpot(TM)
64-Bit Server VM 1.6.0_26) [linux-amd64-java]
  0.836000   0.000000   0.836000 (  0.800000)
  0.388000   0.000000   0.388000 (  0.388000)
  0.399000   0.000000   0.399000 (  0.399000)
  0.334000   0.000000   0.334000 (  0.334000)
  0.351000   0.000000   0.351000 (  0.352000)
% JAVA_HOME=/home/nahi/java/jdk1.6.0_26 jruby163 -v autoload/bench_autoload.rb
jruby 1.6.3 (ruby-1.8.7-p330) (2011-07-07 965162f) (Java HotSpot(TM)
64-Bit Server VM 1.6.0_26) [linux-amd64-java]
  0.836000   0.000000   0.836000 (  0.798000)
  0.415000   0.000000   0.415000 (  0.415000)
  0.414000   0.000000   0.414000 (  0.414000)
  0.362000   0.000000   0.362000 (  0.362000)
  0.380000   0.000000   0.380000 (  0.380000)
% ruby -v autoload/bench_autoload.rb
ruby 1.9.3dev (2011-07-11 revision 32509) [x86_64-linux]
  0.420000   0.000000   0.420000 (  0.423599)
  0.430000   0.000000   0.430000 (  0.436537)
  0.420000   0.000000   0.420000 (  0.430014)
  0.420000   0.000000   0.420000 (  0.432641)
  0.420000   0.000000   0.420000 (  0.427005)
% ruby187 -v autoload/bench_autoload.rb
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
  0.440000   0.000000   0.440000 (  0.436697)
  0.410000   0.000000   0.410000 (  0.416100)
  0.400000   0.000000   0.400000 (  0.411876)
  0.410000   0.000000   0.410000 (  0.414135)
  0.410000   0.000000   0.410000 (  0.409545)
  • Loading branch information...
commit 6b52bf11ad019cb1aaaf86f9db53ba9cd9d015b5 1 parent 1db5fbb
@nahi nahi authored
View
7 bench/autoload/bar.rb
@@ -0,0 +1,7 @@
+# for autoload Foo::Bar
+
+class Foo
+ module Bar
+ X = 1
+ end
+end
View
12 bench/autoload/bench_autoload.rb
@@ -0,0 +1,12 @@
+require 'benchmark'
+$:.unshift(File.expand_path(".", File.dirname(__FILE__)))
+
+5.times do
+ puts Benchmark.measure {
+ 1000000.times do
+ autoload :Foo, "foo"
+ Foo::Baz::Y
+ end
+ }
+ GC.start
+end
View
6 bench/autoload/foo.rb
@@ -0,0 +1,6 @@
+class Foo
+ autoload :Bar, "bar"
+ module Baz
+ Y = Foo::Bar::X + 1
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.