require 'benchmark'
iterations = 100_000
Benchmark.bm(27) do |bm|
bm.report('finding in hash') do
iterations.times do
arr.find{|h| h['start_date'] == '2018'}
end
end
bm.report('detect in hash') do
iterations.times do
arr.detect{|h| h['start_date'] == '2018'}
end
end
bm.report('select in hash') do
iterations.times do
arr.select{|h| h['start_date'] == '2018'}
end
end
end