Created
October 20, 2014 22:10
-
-
Save ogarci5/e8f2895543a706af52f7 to your computer and use it in GitHub Desktop.
Benchmarking rescue versus conditional
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' | |
n = 1_000_000 | |
Benchmark.bm do |x| | |
x.report { n.times {nil.asd if nil} } | |
x.report { n.times {nil.asd rescue nil} } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment