Skip to content

Instantly share code, notes, and snippets.

@c-lliope
c-lliope / bench.rb
Last active December 8, 2015 08:32
benchmarking selectively fetching keys from a ruby hash
require 'benchmark'
ATTRIBUTE_TYPES = {}.tap do |hash|
struct = Struct.new(:searchable?)
50.times do |i|
searchable_val = [true, false].sample
hash[i] = struct.new(searchable_val)
end
end