Skip to content

Instantly share code, notes, and snippets.

@olegantonyan
Created January 11, 2019 16:51
Show Gist options
  • Save olegantonyan/fd1b68b85609ab8e3272912a60044184 to your computer and use it in GitHub Desktop.
Save olegantonyan/fd1b68b85609ab8e3272912a60044184 to your computer and use it in GitHub Desktop.
def benchmark(what)
start = ::Process.clock_gettime(Process::CLOCK_MONOTONIC)
yield
finish = ::Process.clock_gettime(Process::CLOCK_MONOTONIC)
puts "#{what} took #{finish - start} seconds"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment