Skip to content

Instantly share code, notes, and snippets.

@katherholt
Created June 23, 2016 20:47
Show Gist options
  • Save katherholt/026be828f17c16a80549df121fec0c78 to your computer and use it in GitHub Desktop.
Save katherholt/026be828f17c16a80549df121fec0c78 to your computer and use it in GitHub Desktop.
def benchmark
start_time = Time.now
Time.now - start_time
end
long_string = "apple"*100000000
running_time = benchmark { long_string.reverse }
puts "string.reverse took #{running_time} seconds to run"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment