Currently ERROR is not thrown out of the results before they are tested to see 
which is best, this means that ERROR is actually considered the winner after 
running .to_f on it.

My current patch probably doesn't handle the case of each of the rubies being 
tested all having ERROR, but it does work if at least one real value was 
returned. This patch also changes it so that if you are testing a large number 
of ruby installations (4 or more) on a wide terminal window the "----" 
underline will cover all of the names instead of stopping at 80 characters.

diff --git a/perf/run.rb b/perf/run.rb
index 14af044..7279136 100644
--- a/perf/run.rb
+++ b/perf/run.rb
@@ -31,9 +31,10 @@ end
 
 rubies_names = rubies.map { |x| `#{x} -v`.scan(/^\w+\s+[^\s]+/)[0] }
 
-print 'Name'.ljust(20)
-rubies_names.each { |x| print x.ljust(20) }
-puts '', '-' * 80
+header_string = 'Name'.ljust(20)
+rubies_names.each { |x| header_string += x.ljust(20) }
+print header_string
+puts '', '-' * header_string.length
 
 booter = File.join(cwd, 'boot.rb')
 perf_files.each do |file, suite|
@@ -53,7 +54,7 @@ perf_files.each do |file, suite|
     print "#{prefix}:#{title}".ljust(20)
     winner = nil
     if res.size > 1
-      winner = res.sort { |a, b| a[:best].to_f <=> b[:best].to_f }.first[:best]
+      winner = res.reject { |a| a[:best] == 'ERROR' }.sort { |a, b| 
a[:best].to_f <=> b[:best].to_f }.first[:best]
     end
     res.each do |rb|
       best = rb[:best]

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to