[MacRuby-devel] [PATCH] perf/run.rb patch for ignoring ERROR

Thibault Martin-Lagardette thibault.ml at gmail.com
Wed May 26 16:20:49 PDT 2010


Thanks a lot!
I applied the patch in 4167 (along with some minor improvement).

-- 
Thibault Martin-Lagardette



On May 26, 2010, at 14:39, Jordan Breeding wrote:

> 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]_______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20100526/b7ae6cec/attachment.html>


More information about the MacRuby-devel mailing list