Created
January 27, 2012 08:16
-
-
Save brainopia/1687755 to your computer and use it in GitHub Desktop.
benchmark change for rack
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
require 'benchmark/ips' | |
class Boo < Hash | |
def previous_to_hash | |
{}.replace self | |
end | |
def new_to_hash | |
Hash[self] | |
end | |
end | |
boo = Boo.new | |
Benchmark.ips do |x| | |
x.report('previously') { boo.previous_to_hash } | |
x.report('new_to_hash') { boo.new_to_hash } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment