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

ruby-changes:37775

From: nobu <ko1@a...>
Date: Thu, 5 Mar 2015 17:17:41 +0900 (JST)
Subject: [ruby-changes:37775] nobu:r49856 (trunk): driver.rb: name width

nobu	2015-03-05 17:17:26 +0900 (Thu, 05 Mar 2015)

  New Revision: 49856

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49856

  Log:
    driver.rb: name width
    
    * benchmark/driver.rb (BenchmarkDriver#adjusted_results):
      calculate max width of names at last.

  Modified files:
    trunk/benchmark/driver.rb
Index: benchmark/driver.rb
===================================================================
--- benchmark/driver.rb	(revision 49855)
+++ benchmark/driver.rb	(revision 49856)
@@ -81,7 +81,6 @@ class BenchmarkDriver https://github.com/ruby/ruby/blob/trunk/benchmark/driver.rb#L81
     @loop_wl1 = @loop_wl2 = nil
     @ruby_arg = opt[:ruby_arg] || nil
     @opt = opt
-    @name_width = 4             # "name".size
 
     # [[name, [[r-1-1, r-1-2, ...], [r-2-1, r-2-2, ...]]], ...]
     @results = []
@@ -134,7 +133,7 @@ class BenchmarkDriver https://github.com/ruby/ruby/blob/trunk/benchmark/driver.rb#L133
       numformat = " %1$*2$.3f"
     end
 
-    name_width ||= @name_width
+    name_width ||= @results.map {|v,*| v.size}.max
     minwidth ||= 7
     width = @execs.map{|(_, v)| [v.size, minwidth].max}
 
@@ -258,7 +257,6 @@ class BenchmarkDriver https://github.com/ruby/ruby/blob/trunk/benchmark/driver.rb#L257
       output
     end
 
-    @name_width = name.size if name.size > @name_width
     result = [name]
     result << @execs.map{|(e, v)|
       (0...@repeat).map{

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

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