benchmark_driver 0.15.18 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 056db37cfc1c2453c9ab994d4b1241bb450ad7e138e69e2ae4a5995825976753
4
- data.tar.gz: f827c814001e175ebcb878181ff0b6b411466bb34bf4ff4a34e02b0f1fdafdda
3
+ metadata.gz: c01422dfa4032a839397f7151e374767d0596292930e83a132ce934c7734e0b4
4
+ data.tar.gz: ef5ddc5dec5813f662e46f6bccc12910ad74279b12e76c4680240973d04b392f
5
5
  SHA512:
6
- metadata.gz: f34f11c0d5a30be2e232af08d00e2e1b2420a161aa18c1f020a0f342f53804b82da754c61632a008ec7822f710edab2af7a1dde18cf1a67a4e51ab14852b3b3a
7
- data.tar.gz: e0601d752e1f55d95ae2c1b83f6dfaa432290b28856ceca553500597f8b06b508c34909df98cd96f3aaf0989df9d2ef76fa0c1e31099f80486b37fa641ce15dd
6
+ metadata.gz: c6fc200972891784176499cc685a10c6e823982d004fc1c068cb0beccdaa7eabade24da867f3b72f92c8d2db3af9b33bee1a122262d13a962ee19a2b36d2df20
7
+ data.tar.gz: d779167efb7516daba05bdb79b0a332ac6896c7717c70d550a788a7855b50e919d60f7c1ba2ebddfcb857d80bd83e5d716ef6a0807ed373b2065264ef9996f67
@@ -0,0 +1,36 @@
1
+ name: test
2
+ on:
3
+ push:
4
+ branches:
5
+ - master
6
+ pull_request:
7
+ types:
8
+ - opened
9
+ - synchronize
10
+ - reopened
11
+ schedule:
12
+ - cron: "00 15 * * *"
13
+ jobs:
14
+ test:
15
+ runs-on: ubuntu-latest
16
+ strategy:
17
+ matrix:
18
+ ruby:
19
+ - '2.5'
20
+ - '2.6'
21
+ - '2.7'
22
+ - '3.0'
23
+ - '3.1'
24
+ fail-fast: false
25
+ steps:
26
+ - uses: actions/checkout@v2
27
+ - name: Set up Ruby
28
+ uses: ruby/setup-ruby@v1
29
+ with:
30
+ ruby-version: ${{ matrix.ruby }}
31
+ bundler-cache: true
32
+ - name: Install benchmark targets
33
+ run: |
34
+ gem install haml -v 4.0.7
35
+ gem install haml -v 5.0.4
36
+ - run: VERBOSE=1 bundle exec rake
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # v0.16.0
2
+
3
+ - Support benchmarking inline Ruby scripts [#75](https://github.com/benchmark-driver/benchmark-driver/pull/75)
4
+ - Require Ruby 2.5+
5
+ - Fix `recorded` runner for Ruby 3.1's Psych
6
+
1
7
  # v0.15.18
2
8
 
3
9
  - Mention `--output=all` in help
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # BenchmarkDriver [![Build Status](https://travis-ci.org/benchmark-driver/benchmark-driver.svg?branch=master)](https://travis-ci.org/benchmark-driver/benchmark-driver)
1
+ # BenchmarkDriver
2
2
 
3
3
  Fully-featured accurate benchmark driver for Ruby
4
4
 
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.bindir = 'exe'
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ['lib']
22
- spec.required_ruby_version = '>= 2.2.0'
22
+ spec.required_ruby_version = '>= 2.5.0'
23
23
 
24
24
  spec.add_development_dependency 'bundler'
25
25
  spec.add_development_dependency 'rake'
data/exe/benchmark-driver CHANGED
@@ -87,11 +87,11 @@ config = BenchmarkDriver::Config.new.tap do |c|
87
87
  end
88
88
  end
89
89
  begin
90
- c.paths = parser.parse!(ARGV)
90
+ c.args = parser.parse!(ARGV)
91
91
  rescue OptionParser::InvalidArgument => e
92
92
  abort e.message
93
93
  end
94
- if c.paths.empty?
94
+ if c.args.empty?
95
95
  abort "No YAML file is specified!\n\n#{parser.help}"
96
96
  end
97
97
 
@@ -112,24 +112,32 @@ config = BenchmarkDriver::Config.new.tap do |c|
112
112
  end
113
113
 
114
114
  # Parse benchmark job definitions
115
- jobs = config.paths.flat_map do |path|
115
+ jobs = config.args.flat_map do |arg|
116
116
  job = { 'type' => config.runner_type }
117
117
 
118
- # Treat *.rb as a single-execution benchmark, others are considered as YAML definition
119
- if path.end_with?('.rb')
120
- name = File.basename(path).sub(/\.rb\z/, '')
121
- script = File.read(path)
118
+ # Three types of input:
119
+ # * YAML file (*.yml, *.yaml): a regular benchmark with various params
120
+ # * Ruby file (*.rb): a single-execution benchmark
121
+ # * Ruby inline (any other argument): a multi-execution benchmark
122
+ if arg.end_with?('.yml') || arg.end_with?('.yaml')
123
+ yaml = File.read(arg)
124
+ job.merge!(YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(yaml) : YAML.load(yaml))
125
+ elsif arg.end_with?('.rb')
126
+ name = File.basename(arg).sub(/\.rb\z/, '')
127
+ script = File.read(arg)
122
128
  prelude = script.slice!(/\A(^#[^\n]+\n)+/m) || '' # preserve magic comment
123
129
  job.merge!('prelude' => prelude, 'benchmark' => { name => script }, 'loop_count' => 1)
124
- else
125
- job.merge!(YAML.load_file(path))
130
+ else # Ruby inline
131
+ job.merge!('benchmark' => { arg => arg })
132
+ working_directory = Dir.pwd
126
133
  end
134
+ working_directory ||= File.expand_path(File.dirname(arg))
127
135
 
128
136
  begin
129
137
  # `working_directory` is YAML-specific special parameter, mainly for "command_stdout"
130
- BenchmarkDriver::JobParser.parse(job, working_directory: File.expand_path(File.dirname(path)))
138
+ BenchmarkDriver::JobParser.parse(job, working_directory: working_directory)
131
139
  rescue ArgumentError
132
- $stderr.puts "benchmark-driver: Failed to parse #{path.dump}."
140
+ $stderr.puts "benchmark-driver: Failed to parse #{arg.dump}."
133
141
  $stderr.puts ' YAML format may be wrong. See error below:'
134
142
  $stderr.puts
135
143
  raise
@@ -8,7 +8,7 @@ module BenchmarkDriver
8
8
  :runner_type, # @param [String]
9
9
  :output_type, # @param [String]
10
10
  :output_opts, # @param [Hash{ Symbol => Object }]
11
- :paths, # @param [Array<String>]
11
+ :args, # @param [Array<String>]
12
12
  :executables, # @param [Array<BenchmarkDriver::Config::Executable>]
13
13
  :filters, # @param [Array<Regexp>]
14
14
  :repeat_count, # @param [Integer]
@@ -1,3 +1,3 @@
1
1
  module BenchmarkDriver
2
- VERSION = '0.15.18'
2
+ VERSION = '0.16.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: benchmark_driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.18
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-08 00:00:00.000000000 Z
11
+ date: 2022-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -74,9 +74,9 @@ executables:
74
74
  extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
+ - ".github/workflows/test.yml"
77
78
  - ".gitignore"
78
79
  - ".rspec"
79
- - ".travis.yml"
80
80
  - CHANGELOG.md
81
81
  - Gemfile
82
82
  - LICENSE.txt
@@ -139,14 +139,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
139
139
  requirements:
140
140
  - - ">="
141
141
  - !ruby/object:Gem::Version
142
- version: 2.2.0
142
+ version: 2.5.0
143
143
  required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  requirements:
145
145
  - - ">="
146
146
  - !ruby/object:Gem::Version
147
147
  version: '0'
148
148
  requirements: []
149
- rubygems_version: 3.1.2
149
+ rubygems_version: 3.3.7
150
150
  signing_key:
151
151
  specification_version: 4
152
152
  summary: Fully-featured accurate benchmark driver for Ruby
data/.travis.yml DELETED
@@ -1,21 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.3.8
4
- - 2.4.9
5
- - 2.5.7
6
- - 2.6.5
7
- - 2.7.0
8
- - ruby-head
9
- matrix:
10
- allow_failures:
11
- - rvm: ruby-head
12
- cache: bundler
13
- branches:
14
- only:
15
- - master
16
- before_install:
17
- - gem install bundler -v 1.15.4
18
- - gem install haml -v 4.0.7
19
- - gem install haml -v 5.0.4
20
- script:
21
- - VERBOSE=1 bundle exec rake