* 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
@ -1,3 +1,9 @@
|
|||||||
|
Sat Feb 2 20:06:42 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/benchmark.rb (Benchmark::realtime): make Benchmark#realtime
|
||||||
|
a bit faster. a patch from Alexander Dymo <dymo@ukrpost.ua> in
|
||||||
|
[ruby-core:15337].
|
||||||
|
|
||||||
Sat Feb 2 17:40:21 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
Sat Feb 2 17:40:21 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* time.c (time_cmp): Time.<=> no longer supports comparison with
|
* time.c (time_cmp): Time.<=> no longer supports comparison with
|
||||||
|
@ -304,7 +304,10 @@ module Benchmark
|
|||||||
# Returns the elapsed real time used to execute the given block.
|
# Returns the elapsed real time used to execute the given block.
|
||||||
#
|
#
|
||||||
def realtime(&blk) # :yield:
|
def realtime(&blk) # :yield:
|
||||||
Benchmark::measure(&blk).real
|
r0 = Time.now
|
||||||
|
yield
|
||||||
|
r1 = Time.now
|
||||||
|
r1.to_f - r0.to_f
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user