Skip to content

Instantly share code, notes, and snippets.

@zloyrusskiy
Last active August 29, 2015 14:25
Show Gist options
  • Save zloyrusskiy/4d1287ebf637ecf65e16 to your computer and use it in GitHub Desktop.
Save zloyrusskiy/4d1287ebf637ecf65e16 to your computer and use it in GitHub Desktop.
Mini stopwatch
=begin
использовать:
stopwatch 'parsing' do
# код, производительность которого надо замерять
end
=end
def stopwatch message, &block
start = Time.now
result = block.call
puts '%s elapsed %.3f' % [message, Time.now - start]
result
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment