Sha256: d8940464e7ad70d5c423798e44f53abe1892f11af5ab6f4bdcdb66e8568b7a0d
Contents?: true
Size: 325 Bytes
Versions: 26
Compression:
Stored size: 325 Bytes
Contents
#!/usr/bin/env ruby # frozen_string_literal: true 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
Version data entries
26 entries across 26 versions & 1 rubygems