Revision 5096e8a9ac03848fbcf4adc01cac11714428b025 authored by Delson Lima on 12 April 2018, 18:24:55 UTC, committed by jekyllbot on 12 April 2018, 18:24:55 UTC
Merge pull request 6782
1 parent c9346ef
hash-fetch
#!/usr/bin/env ruby
require 'benchmark/ips'
h = {:bar => 'uco'}
Benchmark.ips do |x|
x.report('fetch with no block') { h.fetch(:bar, (0..9).to_a) }
x.report('fetch with a block') { h.fetch(:bar) { (0..9).to_a } }
x.report('brackets with an ||') { h[:bar] || (0..9).to_a }
end
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...