# Unsure if the following is worth anyone's def time. 

class Test
  def or_equals
    @foo ||= 'fo'
  end

  def if_and_return
    @foo = 'foo' unless @foo.nil? 
    @foo
  end

end

REPS = 10_000_000

time_1 = Time.now
REPS.times do 
  t = Test.new
  t.or_equals
  t.or_equals
end
time_2 = Time.now
REPS.times do 
  t = Test.new
  t.if_and_return
  t.if_and_return
end
time_3 = Time.now

puts "or_equals: #{time_2 - time_1}"      # => or_equals: 4.095663
puts "if_and_return: #{time_3 - time_2}"  # => if_and_return: 4.755961

end