-
-
Save metacritical/1866269 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adapted from a script by Evan Phoenix | |
require 'benchmark' | |
GC::Profiler.enable | |
class Simple | |
attr_accessor :next | |
end | |
top = Simple.new | |
puts Benchmark.measure { | |
outer = 10 | |
total = 100000 | |
per = 100 | |
outer.times do | |
total.times do | |
per.times { Simple.new } | |
s = Simple.new | |
top.next = s | |
top = s | |
end | |
end | |
} | |
puts "GC time: #{GC::Profiler.total_time}s" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
system ~/projects/gc_tests $ rvm 1.9.3 do ruby -v gc_stress.rb | |
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0] | |
20.820000 0.240000 21.060000 ( 21.070793) | |
GC time: 2.29012300000049s | |
system ~/projects/gc_tests $ rvm ruby-head do ruby -v gc_stress.rb | |
ruby 2.0.0dev (2012-02-19 trunk 34699) [x86_64-darwin10.8.0] | |
21.740000 0.250000 21.990000 ( 22.002499) | |
GC time: 3.156919999999449s | |
system ~/projects/gc_tests $ (pickjdk 1 ; jruby -v gc_stress.rb) | |
New JDK: 1.6.0.jdk | |
jruby 1.7.0.dev (ruby-1.9.3-p28) (2012-02-19 348601d) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_29) [darwin-x86_64-java] | |
8.655000 0.000000 8.655000 ( 8.655000) | |
GC time: 0.223s | |
system ~/projects/gc_tests $ (pickjdk 2 ; jruby -v gc_stress.rb) | |
New JDK: 1.6.0_30-b12-409.jdk | |
jruby 1.7.0.dev (ruby-1.9.3-p28) (2012-02-19 348601d) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_30) [darwin-x86_64-java] | |
9.354000 0.000000 9.354000 ( 9.354000) | |
GC time: 0.217s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment