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

ruby-changes:3880

From: ko1@a...
Date: Sat, 2 Feb 2008 20:16:23 +0900 (JST)
Subject: [ruby-changes:3880] matz - Ruby:r15369 (ruby_1_8): * lib/benchmark.rb (Benchmark::realtime): make Benchmark#realtime

matz	2008-02-02 20:16:13 +0900 (Sat, 02 Feb 2008)

  New Revision: 15369

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/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/branches/ruby_1_8/ChangeLog?r1=15369&r2=15368&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/lib/benchmark.rb?r1=15369&r2=15368&diff_format=u

Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 15368)
+++ ruby_1_8/ChangeLog	(revision 15369)
@@ -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 09:53:39 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* configure.in (darwin): disabled fat-binary support which confuses
Index: ruby_1_8/lib/benchmark.rb
===================================================================
--- ruby_1_8/lib/benchmark.rb	(revision 15368)
+++ ruby_1_8/lib/benchmark.rb	(revision 15369)
@@ -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/

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