Created
October 3, 2009 11:32
-
-
Save calavera/200601 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#################################### | |
### INTERPRETER BEFORE THE PATCH ### | |
#################################### | |
irb(main):002:0> Benchmark.bm { |x| x.report { for i in 1..5000; h = {"foo" => "foo", "bar" => "bar", "zoo" => "zoo", "baaz" => "baaz"}; end } } | |
user system total real | |
0.197000 0.000000 0.197000 ( 0.196000) | |
=> true | |
################################### | |
### INTERPRETER AFTER THE PATCH ### | |
################################### | |
irb(main):002:0> Benchmark.bm { |x| x.report { for i in 1..5000; h = {"foo" => "foo", "bar" => "bar", "zoo" => "zoo", "baaz" => "baaz"}; end } } | |
user system total real | |
0.221000 0.000000 0.221000 ( 0.220000) | |
=> true | |
################################## | |
### COMPILER BEFORE THE PATCH ### | |
################################## | |
user system total real | |
0.239000 0.000000 0.239000 ( 0.180000) | |
################################## | |
### COMPILER AFTER THE PATCH ### | |
################################## | |
user system total real | |
0.267000 0.000000 0.267000 ( 0.206000) |
This file contains hidden or 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
require 'benchmark' | |
Benchmark.bm do |x| | |
x.report { | |
(1..5000).each do | |
k = "foo" | |
h = {k => "foo", "bar" => "bar", "zoo" => "zoo", "baaz" => "baaz"} | |
k.reverse! | |
h[k] | |
end | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment