benchmark_driver 0.15.7 → 0.15.8

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: ad73033408aa70dae54e87ff9fbcfee14ba00ecf22201113f3f09083c57e9781
4
- data.tar.gz: d6bc8f3296d6cbc1565a3fd69e69ad6eda942a72d7b5d388f415b81911f11339
3
+ metadata.gz: e04ca43a3337139b2b4608642785f79e058062c9559a77bb488c4b6171d6f6a5
4
+ data.tar.gz: 9f3d95083d39c13dcb7586a949df6d6ac95253f5ae0f36c1e611e1ed45316a6c
5
5
  SHA512:
6
- metadata.gz: 769c47a0c5a81ef93d6e264458b401fc1174f6847796c8c763ef0a258e4d3f9946761564789e1063370d8938e91af4f71b5f7b2ab5503f3de87dc3bef6579e87
7
- data.tar.gz: 3cdfd3dcf42fa8aaf231027101be1f270e660e2488b4a7a107a52602d8e60d601d2869ee5b47f3c3831b57583c6a055fbbb9ea2ba5170b84b94f68227f9f3561
6
+ metadata.gz: 513c1e5dbe4703708fb13cf970b1c96c14ff008ebfc5f13381388d5d857f1b76089cfd1b8347ef8a50461af5aa9aeed79180f1dcd68341586cb77081bed01cd1
7
+ data.tar.gz: a90e8729e8724ad50fb42731d5e3fa53acb5a722e3eb2ae26f18a435f9cb02af6eb0a6a69a2676cb02cceab9d7cc563b751e477819497f99fcedf42a918362a6
@@ -1,9 +1,10 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.3.8
4
- - 2.4.6
5
- - 2.5.5
6
- - 2.6.3
4
+ - 2.4.9
5
+ - 2.5.7
6
+ - 2.6.5
7
+ - 2.7.0
7
8
  - ruby-head
8
9
  matrix:
9
10
  allow_failures:
@@ -1,3 +1,7 @@
1
+ # v0.15.8
2
+
3
+ - Add `--rvm` option and `.rvm` Ruby interface to use RVM
4
+
1
5
  # v0.15.7
2
6
 
3
7
  - Add `median` to --repeat-result options
data/README.md CHANGED
@@ -75,6 +75,7 @@ Usage: benchmark-driver [options] [YAML|RUBY]
75
75
  -o, --output [TYPE] Specify output type: compare, simple, markdown, record (default: compare)
76
76
  -e, --executables [EXECS] Ruby executables (e1::path1 arg1; e2::path2 arg2;...)
77
77
  --rbenv [VERSIONS] Ruby executables in rbenv (x.x.x arg1;y.y.y arg2;...)
78
+ --rvm [VERSIONS] Ruby executables in rvm (x.x.x arg1;y.y.y arg2;...)
78
79
  --repeat-count [NUM] Try benchmark NUM times and use the fastest result or the worst memory usage
79
80
  --repeat-result [TYPE] Yield "best", "average" or "worst" result with --repeat-count (default: best)
80
81
  --bundler Install and use gems specified in Gemfile
@@ -48,6 +48,11 @@ config = BenchmarkDriver::Config.new.tap do |c|
48
48
  executables << BenchmarkDriver::Rbenv.parse_spec(version)
49
49
  end
50
50
  end if system("which rbenv > #{File::NULL} 2>&1")
51
+ o.on('--rvm VERSIONS', String, 'Ruby executables in rvm (x.x.x arg1;y.y.y arg2;...)') do |r|
52
+ r.split(';').each do |version|
53
+ executables << BenchmarkDriver::Rvm.parse_spec(version)
54
+ end
55
+ end if system("which rvm > #{File::NULL} 2>&1")
51
56
  o.on('--ridkuse VERSIONS', String, 'Ruby executables in ridk use (x.x.x arg1;y.y.y arg2;...) for RubyInstaller2 on Windows') do |r|
52
57
  r.split(';').each do |version|
53
58
  executables << BenchmarkDriver::RidkUse.parse_spec(version)
@@ -3,6 +3,7 @@ require 'benchmark_driver/config'
3
3
  require 'benchmark_driver/job_parser'
4
4
  require 'benchmark_driver/output'
5
5
  require 'benchmark_driver/rbenv'
6
+ require 'benchmark_driver/rvm'
6
7
  require 'benchmark_driver/repeater'
7
8
  require 'benchmark_driver/ridkuse'
8
9
  require 'benchmark_driver/ruby_interface'
@@ -11,7 +11,7 @@ module BenchmarkDriver
11
11
  path
12
12
  end
13
13
 
14
- # @param [String] full_spec - "2.5.0", "2.5.0,--jit", "JIT::2.5.0,--jit", etc.
14
+ # @param [String] full_spec - "2.5.0", "2.5.0 --jit", "JIT::2.5.0 --jit", etc.
15
15
  def self.parse_spec(full_spec)
16
16
  name, spec = full_spec.split('::', 2)
17
17
  spec ||= name # if `::` is not given, regard whole string as spec
@@ -62,14 +62,7 @@ module BenchmarkDriver
62
62
  end
63
63
 
64
64
  def median_result_i(a)
65
- b = a.dup
66
- b.sort!
67
- x = y = nil
68
- until b.empty? do
69
- x = b.pop
70
- y = b.shift
71
- end
72
- x || y
65
+ a.sort[a.size/2]
73
66
  end
74
67
 
75
68
  def median_result(values, rest_on_average)
@@ -43,7 +43,7 @@ module BenchmarkDriver
43
43
  end
44
44
  end
45
45
 
46
- # @param [String] full_spec - "2.6.3", "2.6.3p62", "2.6.3,--jit", etc.
46
+ # @param [String] full_spec - "2.6.3", "2.6.3p62", "2.6.3 --jit", etc.
47
47
  def self.parse_spec(full_spec)
48
48
  name, spec = full_spec.split('::', 2)
49
49
  spec ||= name # if `::` is not given, regard whole string as spec
@@ -71,6 +71,12 @@ module BenchmarkDriver
71
71
  end
72
72
  end
73
73
 
74
+ def rvm(*versions)
75
+ versions.each do |version|
76
+ @executables << BenchmarkDriver::Rvm.parse_spec(version)
77
+ end
78
+ end
79
+
74
80
  # ridk use command for RubyInstaller2 on Windows
75
81
  def ridkuse(*versions)
76
82
  versions.each do |version|
@@ -0,0 +1,48 @@
1
+ require 'shellwords'
2
+ require 'pathname'
3
+
4
+ module BenchmarkDriver
5
+ module Rvm
6
+ # Execute "which -a ruby" command to get a list of Ruby versions from $PATH.
7
+ def self.system_ruby_path
8
+ env_rubies = `which -a ruby`
9
+ abort "Failed to execute 'which -a ruby'" unless $?.success?
10
+
11
+ env_rubies.each_line do |line|
12
+ if !line.match(ENV['rvm_path'])
13
+ return line.rstrip
14
+ end
15
+ end
16
+ abort "System ruby not found"
17
+ end
18
+
19
+ # @param [String] version
20
+ def self.ruby_path(version)
21
+ path = if version == 'system'
22
+ system_ruby_path
23
+ else
24
+ rubies = Pathname.new("#{ENV['rvm_path']}/rubies")
25
+ abort "Rubies path '#{rubies}' not found" unless rubies.exist?
26
+ ruby_root = rubies.children.detect { |path| path.directory? && path.basename.to_s.match(version) }
27
+ abort "Version '#{version}' not found" unless ruby_root
28
+ "#{ruby_root}/bin/ruby"
29
+ end
30
+
31
+ unless File.exist?(path)
32
+ abort "Binary '#{path}' not found"
33
+ end
34
+ path
35
+ end
36
+
37
+ # @param [String] full_spec - "2.5.0", "2.5.0 --jit", "JIT::2.5.0 --jit", etc.
38
+ def self.parse_spec(full_spec)
39
+ name, spec = full_spec.split('::', 2)
40
+ spec ||= name # if `::` is not given, regard whole string as spec
41
+ version, *args = spec.shellsplit
42
+ BenchmarkDriver::Config::Executable.new(
43
+ name: name,
44
+ command: [BenchmarkDriver::Rvm.ruby_path(version), *args],
45
+ )
46
+ end
47
+ end
48
+ end
@@ -1,3 +1,3 @@
1
1
  module BenchmarkDriver
2
- VERSION = '0.15.7'
2
+ VERSION = '0.15.8'
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.7
4
+ version: 0.15.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-19 00:00:00.000000000 Z
11
+ date: 2020-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -124,6 +124,7 @@ files:
124
124
  - lib/benchmark_driver/runner/recorded.rb
125
125
  - lib/benchmark_driver/runner/ruby_stdout.rb
126
126
  - lib/benchmark_driver/runner/time.rb
127
+ - lib/benchmark_driver/rvm.rb
127
128
  - lib/benchmark_driver/struct.rb
128
129
  - lib/benchmark_driver/version.rb
129
130
  homepage: https://github.com/benchmark-driver/benchmark-driver
@@ -145,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
146
  - !ruby/object:Gem::Version
146
147
  version: '0'
147
148
  requirements: []
148
- rubygems_version: 3.0.3
149
+ rubygems_version: 3.1.2
149
150
  signing_key:
150
151
  specification_version: 4
151
152
  summary: Fully-featured accurate benchmark driver for Ruby