Skip to content

Instantly share code, notes, and snippets.

@alanpeabody
Last active December 22, 2015 20:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alanpeabody/6524034 to your computer and use it in GitHub Desktop.
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