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

ruby-changes:51674

From: k0kubun <ko1@a...>
Date: Sun, 8 Jul 2018 22:03:05 +0900 (JST)
Subject: [ruby-changes:51674] k0kubun:r63886: benchmark: drop legacy benchmark drivers

k0kubun	2018-07-08 22:03:01 +0900 (Sun, 08 Jul 2018)

  New Revision: 63886

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

  Log:
    benchmark: drop legacy benchmark drivers
    
    It seems like they are all benchmark drivers but "benchmark/driver.rb"
    is the latest and others are no longer used.
    
    It's confusing to have multiple drivers (and actually I used
    benchmark/run.rb since I didn't know I should use benchmark/driver.rb).
    
    As I'm going to support only benchmark/driver.rb features in Misc#14902,
    let me delete them.

  Removed files:
    trunk/benchmark/report.rb
    trunk/benchmark/run.rb
    trunk/benchmark/runc.rb
Index: benchmark/report.rb
===================================================================
--- benchmark/report.rb	(revision 63885)
+++ benchmark/report.rb	(nonexistent)
@@ -1,79 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/report.rb#L0
-#
-# YARV benchmark driver
-#
-
-require 'yarvutil'
-require 'benchmark'
-require 'rbconfig'
-
-def exec_command type, file, w
-  <<-EOP
-  $DRIVER_PATH = '#{File.dirname($0)}'
-  $LOAD_PATH.replace $LOAD_PATH | #{$LOAD_PATH.inspect}
-  require 'benchmark'
-  require 'yarvutil'
-#  print '#{type}'
-  begin
-    puts Benchmark.measure{
-      #{w}('#{file}')
-    }.utime
-  rescue Exception => exec_command_error_variable
-    puts "\t" + exec_command_error_variable.message
-  end
-  EOP
-end
-
-def benchmark cmd
-  rubybin = ENV['RUBY'] || RbConfig.ruby
-
-  IO.popen(rubybin, 'r+'){|io|
-    io.write cmd
-    io.close_write
-    return io.gets
-  }
-end
-
-def ruby_exec file
-  prog = exec_command 'ruby', file, 'load'
-  benchmark prog
-end
-
-def yarv_exec file
-  prog = exec_command 'yarv', file, 'YARVUtil.load_bm'
-  benchmark prog
-end
-
-$wr = $wy = nil
-
-def measure bench
-  file = File.dirname($0) + "/bm_#{bench}.rb"
-  r = ruby_exec(file).to_f
-  y = yarv_exec(file).to_f
-  puts "#{bench}\t#{r}\t#{y}"
-end
-
-def measure2
-  r = ruby_exec.to_f
-  y = yarv_exec.to_f
-  puts r/y
-end
-
-if $0 == __FILE__
-  %w{
-    whileloop
-    whileloop2
-    times
-    const
-    method
-    poly_method
-    block
-    rescue
-    rescue2
-  }.each{|bench|
-    measure bench
-  }
-end
-
-
-
-

Property changes on: benchmark/report.rb
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-LF
\ No newline at end of property
Index: benchmark/runc.rb
===================================================================
--- benchmark/runc.rb	(revision 63885)
+++ benchmark/runc.rb	(nonexistent)
@@ -1,27 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/runc.rb#L0
-#
-#
-#
-
-require 'benchmark'
-require 'rbconfig'
-
-$rubybin = ENV['RUBY'] || RbConfig.ruby
-
-def runfile file
-  puts file
-  file = File.join(File.dirname($0), 'contrib', file)
-  Benchmark.bm{|x|
-    x.report('ruby'){
-      system("#{$rubybin} #{file}")
-    }
-    x.report('yarv'){
-      system("#{$rubybin} -rite -I.. #{file}")
-    }
-  }
-end
-
-ARGV.each{|file|
-  runfile file
-}
-
-

Property changes on: benchmark/runc.rb
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-LF
\ No newline at end of property
Index: benchmark/run.rb
===================================================================
--- benchmark/run.rb	(revision 63885)
+++ benchmark/run.rb	(nonexistent)
@@ -1,127 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/run.rb#L0
-#
-# Ruby benchmark driver
-#
-
-require 'benchmark'
-require 'rbconfig'
-
-$matzrubyonly = false
-$rubyonly = false
-
-$results  = []
-
-# prepare 'wc.input'
-def prepare_wc_input
-  wcinput = File.join(File.dirname($0), 'wc.input')
-  wcbase  = File.join(File.dirname($0), 'wc.input.base')
-  unless FileTest.exist?(wcinput)
-    data = File.read(wcbase)
-    13.times{
-      data << data
-    }
-    open(wcinput, 'w'){|f| f.write data}
-  end
-end
-
-prepare_wc_input
-
-def bm file
-  prog = File.readlines(file).map{|e| e.rstrip}.join("\n")
-  return if prog.empty?
-
-  /[a-z]+_(.+)\.rb/ =~ file
-  bm_name = $1
-  puts '-----------------------------------------------------------' unless $rubyonly || $matzrubyonly
-  puts "#{bm_name}: "
-
-
-puts <<EOS unless $matzrubyonly || $rubyonly
-#{prog}
---
-EOS
-  begin
-    result = [bm_name]
-    result << matzruby_exec(file) unless $rubyonly
-    result << ruby_exec(file) unless $matzrubyonly
-    $results << result
-
-  rescue Exception => e
-    puts
-    puts "** benchmark failure: #{e}"
-    puts e.backtrace
-  end
-end
-
-def benchmark file, bin
-  m = Benchmark.measure{
-    `#{bin} #{$opts} #{file}`
-  }
-  sec = '%.3f' % m.real
-  puts " #{sec}"
-  sec
-end
-
-def ruby_exec file
-  print 'ruby'
-  benchmark file, $ruby_program
-end
-
-def matzruby_exec file
-  print 'matz'
-  rubylib = ENV['RUBYLIB']
-  ENV['RUBYLIB'] = ''
-  r = benchmark file, $matzruby_program
-  ENV['RUBYLIB'] = rubylib
-  r
-end
-
-if $0 == __FILE__
-  ARGV.each{|arg|
-    case arg
-    when /\A--ruby=(.+)/
-      $ruby_program = $1
-    when /\A--matzruby=(.+)/
-      $matzruby_program = $1
-    when /\A--opts=(.+)/
-      $opts = $1
-    when /\A(-r|--only-ruby)\z/
-      $rubyonly = true
-    when /\A(-m|--only-matzruby)\z/
-      $matzrubyonly = true
-    end
-  }
-  ARGV.delete_if{|arg|
-    /\A-/ =~ arg
-  }
-
-  puts "MatzRuby:"
-  system("#{$matzruby_program} -v")
-  puts "Ruby:"
-  system("#{$ruby_program} -v")
-  puts
-
-  if ARGV.empty?
-    Dir.glob(File.dirname(__FILE__) + '/bm_*.rb').sort.each{|file|
-      bm file
-    }
-  else
-    ARGV.each{|file|
-      Dir.glob(File.join(File.dirname(__FILE__), file + '*')){|ef|
-        # file = "#{File.dirname(__FILE__)}/#{file}.rb"
-        bm ef
-      }
-    }
-  end
-
-  puts
-  puts "-- benchmark summary ---------------------------"
-  $results.each{|res|
-    print res.shift, "\t"
-    (res||[]).each{|result|
-      /([\d\.]+)/ =~ result
-      print $1 + "\t" if $1
-    }
-    puts
-  }
-end
-

Property changes on: benchmark/run.rb
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-LF
\ No newline at end of property

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

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