Created
August 13, 2018 07:16
-
-
Save olegantonyan/735848cb0f188410ca3863de718e7c53 to your computer and use it in GitHub Desktop.
ruby monotonic timer benchmark
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 benchmark(what) | |
start = ::Process.clock_gettime(Process::CLOCK_MONOTONIC) | |
yield | |
finish = ::Process.clock_gettime(Process::CLOCK_MONOTONIC) | |
sap "#{what} took #{finish - start} seconds" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment