Created
January 19, 2012 09:56
-
-
Save stevebartholomew/1639128 to your computer and use it in GitHub Desktop.
time a block of ruby code
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
# Example: | |
# rendered_content = t("rendering layout") do | |
# layout.render('item' => self, 'contents' => contents) | |
# end | |
# | |
def t(title, &block) | |
puts "===========" | |
puts title | |
beginning_time = Time.now | |
result = yield | |
end_time = Time.now | |
puts "Time elapsed #{(end_time - beginning_time)*1000} millisecond" | |
puts "==========" | |
result | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment