Skip to content

Commit 29674ec

Browse files
committed
Simplify realtime method
We probably aren't running these benchmarks on rubies that don't have these methods. If we are, they probably don't have their own alternate implementation of Benchmark.realtime. If we need to support something else we should just add a version that uses Time.now.to_f.
1 parent dfe53c5 commit 29674ec

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

harness/harness.rb

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,10 @@
1818

1919
puts RUBY_DESCRIPTION
2020

21-
if defined?(Process.clock_gettime) && defined?(Process::CLOCK_MONOTONIC)
22-
def realtime
23-
r0 = Process.clock_gettime(Process::CLOCK_MONOTONIC)
24-
yield
25-
Process.clock_gettime(Process::CLOCK_MONOTONIC) - r0
26-
end
27-
else
28-
require "benchmark"
29-
30-
def realtime(&block)
31-
Benchmark.realtime(&block)
32-
end
21+
def realtime
22+
r0 = Process.clock_gettime(Process::CLOCK_MONOTONIC)
23+
yield
24+
Process.clock_gettime(Process::CLOCK_MONOTONIC) - r0
3325
end
3426

3527
# Takes a block as input

0 commit comments

Comments
 (0)