[前][次][番号順一覧][スレッド一覧]

ruby-changes:3879

From: ko1@a...
Date: Sat, 2 Feb 2008 20:09:37 +0900 (JST)
Subject: [ruby-changes:3879] matz - Ruby:r15368 (trunk): * lib/benchmark.rb (Benchmark::realtime): make Benchmark#realtime

matz	2008-02-02 20:09:24 +0900 (Sat, 02 Feb 2008)

  New Revision: 15368

  Modified files:
    trunk/ChangeLog
    trunk/lib/benchmark.rb

  Log:
    * lib/benchmark.rb (Benchmark::realtime): make Benchmark#realtime
      a bit faster.  a patch from Alexander Dymo <dymo@u...> in
      [ruby-core:15337].

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15368&r2=15367&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/benchmark.rb?r1=15368&r2=15367&diff_format=u

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 15367)
+++ ChangeLog	(revision 15368)
@@ -1,3 +1,9 @@
+Sat Feb  2 20:06:42 2008  Yukihiro Matsumoto  <matz@r...>
+
+	* lib/benchmark.rb (Benchmark::realtime): make Benchmark#realtime
+	  a bit faster.  a patch from Alexander Dymo <dymo@u...> in
+	  [ruby-core:15337].
+
 Sat Feb  2 17:40:21 2008  NARUSE, Yui  <naruse@r...>
 
 	* time.c (time_cmp): Time.<=> no longer supports comparison with
Index: lib/benchmark.rb
===================================================================
--- lib/benchmark.rb	(revision 15367)
+++ lib/benchmark.rb	(revision 15368)
@@ -304,7 +304,10 @@
   # 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
 
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]