require 'benchmark' class Object def either?(*args) args.include? self end def in?(*args) case args.length when 0 false when 1 self == args[0] when 2 self == args[0] || self == args[1] else args.include?(self) end end end count = 10000000 Benchmark.bmbm do |x| x.report "includes?" do count.times do [:one, :two].include?(:one) end end x.report "either?" do count.times do :one.either?(:one, :two) end end x.report "compare" do count.times do :one == :one or :one == :two end end end