Created
July 9, 2012 12:19
-
-
Save codesoda/3076151 to your computer and use it in GitHub Desktop.
Time ruby code in the console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def time_for | |
started_at = Time.now | |
yield | |
elapsed = Time.now - started_at | |
end | |
# elapsed = time_for { 5 * i } | |
# otherwise Benchmark.measure { 5 * i } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment