mirror of
https://github.com/jekyll/jekyll.git
synced 2026-01-30 01:08:26 -05:00
Calculating ------------------------------------- fetch with no block 66979 i/100ms fetch with a block 138257 i/100ms brackets with an || 145792 i/100ms ------------------------------------------------- fetch with no block 1255521.2 (±5.2%) i/s - 6296026 in 5.028856s fetch with a block 6402972.5 (±8.1%) i/s - 31799110 in 5.002554s brackets with an || 8536511.4 (±8.1%) i/s - 42425472 in 5.005831s
10 lines
275 B
Plaintext
10 lines
275 B
Plaintext
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
|