-
-
Save havenwood/72434aba0785bd915942898b42fd3175 to your computer and use it in GitHub Desktop.
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
module Benchmark | |
module_function def orbyt unit: :nanosecond | |
start_time = Process.clock_gettime Process::CLOCK_MONOTONIC, unit | |
yield | |
end_time = Process.clock_gettime Process::CLOCK_MONOTONIC, unit | |
"#{end_time - start_time} #{unit}s" | |
end | |
end | |
Benchmark.orbyt { 'orbyt' == 'orbyt' } | |
#=> "65138 nanoseconds" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment