Skip to content

Instantly share code, notes, and snippets.

@alanpeabody
Last active December 22, 2015 20:08
Show Gist options
  • Select an option

  • Save alanpeabody/6524034 to your computer and use it in GitHub Desktop.

Select an option

Save alanpeabody/6524034 to your computer and use it in GitHub Desktop.
Time how long something take in ruby.
def time
start = Time.now
yield
stop = Time.now
stop - start
end
# Usage:
time { method_to_test }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment