ruby-changes:51706
From: k0kubun <ko1@a...>
Date: Tue, 10 Jul 2018 01:31:44 +0900 (JST)
Subject: [ruby-changes:51706] k0kubun:r63918 (trunk): benchmark/driver.rb: fully obsolete this
k0kubun 2018-07-10 01:31:35 +0900 (Tue, 10 Jul 2018) New Revision: 63918 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63918 Log: benchmark/driver.rb: fully obsolete this in favor of just using benchmark_driver.gem. common.mk: The new `make benchmark` covers the both usages for old `make benchmark` and old `make benchmark-each`. So `make benchmark-each` is dropped now. benchmark/README.md: Explain its details Removed files: trunk/benchmark/driver.rb Modified files: trunk/benchmark/README.md trunk/common.mk Index: benchmark/driver.rb =================================================================== --- benchmark/driver.rb (revision 63917) +++ benchmark/driver.rb (nonexistent) @@ -1,105 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/driver.rb#L0 -#!/usr/bin/env ruby -# -# Wrapper of benchmark-driver command for `make benchmark` and `make benchmark-each`. -# - -begin - require 'optparse' -rescue LoadError - $:.unshift File.join(File.dirname(__FILE__), '../lib') - require 'optparse' -end - -require 'shellwords' - -class BenchmarkDriver - # Run benchmark-driver prepared by `make update-benchmark-driver` - def self.run(*args) - benchmark_driver = File.expand_path('./benchmark-driver/exe/benchmark-driver', __dir__) - command = [benchmark_driver, *args] - unless system(command.shelljoin) - abort "Failed to execute: #{command.shelljoin}" - end - end - - def initialize(opt = {}) - @dir = opt[:dir] - @pattern = opt[:pattern] - @exclude = opt[:exclude] - end - - def files - Dir.glob(File.join(@dir, '*.yml')).map{|file| - next if @pattern && /#{@pattern}/ !~ File.basename(file) - next if @exclude && /#{@exclude}/ =~ File.basename(file) - file - }.compact.sort - end -end - -if __FILE__ == $0 - opt = { - runner: 'ips', - output: 'compare', - execs: [], - rbenvs: [], - repeat: 1, - verbose: [], - dir: File.dirname(__FILE__), - } - - parser = OptionParser.new{|o| - # - # Original benchmark-driver imitation - # - o.on('-r', '--runner [TYPE]', 'Specify runner type: ips, time, memory, once (default: ips)'){|r| - abort '-r, --runner must take argument but not given' if r.nil? - opt[:runner] = r - } - o.on('-o', '--output [TYPE]', 'Specify output type: compare, simple, markdown, record (default: compare)'){|o| - abort '-o, --output must take argument but not given' if o.nil? - opt[:output] = o - } - o.on('-e', '--executables [EXECS]', - "Specify benchmark one or more targets (e1::path1; e2::path2; e3::path3;...)"){|e| - e.split(/;/).each{|path| - opt[:execs] << path - } - } - o.on('--rbenv [VERSIONS]', 'Specify benchmark targets with rbenv version (vX.X.X;vX.X.X;...)'){|v| - opt[:rbenvs] << v - } - o.on('--repeat-count [NUM]', "Repeat count"){|n| - opt[:repeat] = n.to_i - } - o.on('-v', '--verbose', 'Verbose mode. Multiple -v options increase visilibity (max: 2)'){|v| - opt[:verbose] << '-v' - } - - # - # benchmark/driver.rb original (deprecated, to be removed later) - # - o.on('--directory [DIRECTORY]', "Benchmark suites directory"){|d| - opt[:dir] = d - } - o.on('--pattern [PATTERN]', "Benchmark name pattern"){|p| - opt[:pattern] = p - } - o.on('--exclude [PATTERN]', "Benchmark exclude pattern"){|e| - opt[:exclude] = e - } - } - - yamls = parser.parse!(ARGV) - yamls += BenchmarkDriver.new(opt).files - - # Many variables in Makefile are not `foo,bar` but `foo bar`. So it's converted here. - execs = opt[:execs].map { |exec| ['--executables', exec] }.flatten - rbenv = opt[:rbenvs].map { |r| ['--rbenv', r] } - - BenchmarkDriver.run( - *yamls, *execs, *rbenv, *opt[:verbose], - "--runner=#{opt[:runner]}", "--output=#{opt[:output]}", - "--repeat-count=#{opt[:repeat]}", - ) -end Property changes on: benchmark/driver.rb ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -LF \ No newline at end of property Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: common.mk =================================================================== --- common.mk (revision 63917) +++ common.mk (revision 63918) @@ -1113,24 +1113,19 @@ bisect-ruby: PHONY https://github.com/ruby/ruby/blob/trunk/common.mk#L1113 COMPARE_RUBY = $(BASERUBY) ITEM = +ARGS = $(srcdir)/benchmark/*$(ITEM)*.yml OPTS = # You can pass several options through OPTS environment variable. -# $ make benchmark OPTS="--help" displays more detail. +# $ make benchmark ARGS="--help" displays more detail. # for example, # $ make benchmark COMPARE_RUBY="ruby-trunk" OPTS="-e ruby-2.2.2" # This command compares trunk and built-ruby and 2.2.2 benchmark: miniruby$(EXEEXT) update-benchmark-driver PHONY - $(BASERUBY) $(srcdir)/benchmark/driver.rb \ + $(BASERUBY) -rrubygems $(srcdir)/benchmark/benchmark-driver/exe/benchmark-driver \ --executables="compare-ruby::$(COMPARE_RUBY) -I$(EXTOUT)/common --disable-gem" \ --executables="built-ruby::$(MINIRUBY) -r$(srcdir)/prelude --disable-gem" \ - --directory=$(srcdir)/benchmark $(OPTS) - -benchmark-each: miniruby$(EXEEXT) update-benchmark-driver PHONY - $(BASERUBY) $(srcdir)/benchmark/driver.rb \ - --executables="compare-ruby::$(COMPARE_RUBY) -I$(EXTOUT)/common --disable-gem" \ - --executables="built-ruby::$(MINIRUBY) -r$(srcdir)/prelude --disable-gem" \ - --pattern=$(ITEM) --directory=$(srcdir)/benchmark $(OPTS) + $(ARGS) $(OPTS) run.gdb: echo set breakpoint pending on > run.gdb Index: benchmark/README.md =================================================================== --- benchmark/README.md (revision 63917) +++ benchmark/README.md (revision 63918) @@ -31,19 +31,16 @@ make benchmark https://github.com/ruby/ruby/blob/trunk/benchmark/README.md#L31 # Or compare with specific ruby binary make benchmark COMPARE_RUBY="/path/to/ruby --jit" -# You can specify any option via $OPTS -make benchmark OPTS="--help" -``` - -## make benchmark-each +# Run vm1 benchmarks +make benchmark ITEM=vm1 -`make benchmark-each` is similar to `make benchmark`, but it allows to execute -some specific benchmarks. +# Run some limited benchmarks in ITEM-matched files +make benchmark ITEM=vm1 OPTS=--filter=block -```bash -# Run vm1 benchmarks -make benchmark-each ITEM=vm1 +# You can specify the benchmark by an exact filename instead of using +# the default argument: ARGS=$(srcdir)/benchmark/*$(ITEM)*.yml +make benchmark ARGS=../benchmark/erb_render.yml -# Match erb but exclude app_erb to run only erb_render -make benchmark-each ITEM=erb OPTS="--exclude=app_erb" +# You can specify any option via $OPTS +make benchmark OPTS="--help" ``` -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/