Skip to content

Instantly share code, notes, and snippets.

@Solnse
Last active December 11, 2015 00:28
Show Gist options
  • Save Solnse/4516487 to your computer and use it in GitHub Desktop.
Save Solnse/4516487 to your computer and use it in GitHub Desktop.
basic performance calculator.
def measure(repeat = 1)
start_calc = 0
end_calc = 0
total_time = 0
repeat.times do
start_calc = Time.now
yield
end_calc = Time.now
total_time = total_time + (end_calc - start_calc)
end
return total_time / repeat
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment