mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/benchmark.rb (Benchmark::realtime): make Benchmark#realtime
a bit faster. a patch from Alexander Dymo <dymo@ukrpost.ua> in [ruby-core:15337]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
887485907e
commit
6445ddf14a
2 changed files with 10 additions and 1 deletions
|
@ -304,7 +304,10 @@ module Benchmark
|
|||
# Returns the elapsed real time used to execute the given block.
|
||||
#
|
||||
def realtime(&blk) # :yield:
|
||||
Benchmark::measure(&blk).real
|
||||
r0 = Time.now
|
||||
yield
|
||||
r1 = Time.now
|
||||
r1.to_f - r0.to_f
|
||||
end
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue