benchmark_driver 0.2.0 → 0.2.1

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
  SHA1:
3
- metadata.gz: 027b33623e6d71484da812d92ef6d4acbf154312
4
- data.tar.gz: cb8da42411f02760787b766fa0d8a8622750ecd4
3
+ metadata.gz: 1d790640dbf5f88319e5252499c855d694844e5a
4
+ data.tar.gz: 4d41672bc6d38b0564127ca370a16acfa3e72e83
5
5
  SHA512:
6
- metadata.gz: a666e41732c84ab63b0b93460b77b01e2b1540b00199f4c71971b7da532f0531bd6daf9813c87a91f55be51fc37fd2ca12723062b294017986d9f98261df4475
7
- data.tar.gz: ea81b5f7b48a02c99f5718ec4dff48e25dc07eede56d1194172ca209057a4d170405082907d2f3937a91779ee11a08e1dc443afbc29a355782d540923382c5a0
6
+ metadata.gz: adbfe1cd9df1d9641bce90a41ee93322b1ddcc052943bb895182e89f0a600f13ea1cc5e60186b6cd8e9b5e3e1b8ea611002572af2f8b411c577a8c0e639c858a
7
+ data.tar.gz: f97cfb1b70fbe87c07ba650fb65ec706d35dbb308514f00f794c32357ae5f470f66dfbe0dca7d8361bd38c9cff644b4dc00c7af280b7b88dab4ee45f6978deb2
data/.travis.yml CHANGED
@@ -3,3 +3,9 @@ language: ruby
3
3
  rvm:
4
4
  - 2.4.1
5
5
  before_install: gem install bundler -v 1.15.4
6
+ script:
7
+ - bundle exec rake
8
+
9
+ # Test some options
10
+ - bundle exec exe/benchmark_driver benchmarks/example_single.yml -e ruby1::ruby -e ruby2::ruby -i
11
+ - bundle exec exe/benchmark_driver benchmarks/example_single.yml -e ruby1::ruby -e ruby2::ruby -i 2
data/README.md CHANGED
@@ -31,7 +31,7 @@ benchmark: erb.result
31
31
  you can benchmark the script with multiple ruby executables.
32
32
 
33
33
  ```
34
- $ exe/benchmark_driver ruby_benchmark_set/example_single.yml -e ruby1::ruby -e ruby2::ruby
34
+ $ exe/benchmark_driver benchmarks/example_single.yml -e ruby1::ruby -e ruby2::ruby
35
35
  benchmark results:
36
36
  Execution time (sec)
37
37
  name ruby1 ruby2
@@ -45,7 +45,7 @@ example_single 0.986
45
45
  And you can change benchmark output to IPS (iteration per second) by `-i` option.
46
46
 
47
47
  ```
48
- $ exe/benchmark_driver ruby_benchmark_set/example_single.yml -e ruby1::ruby -e ruby2::ruby -i
48
+ $ exe/benchmark_driver benchmarks/example_single.yml -e ruby1::ruby -e ruby2::ruby -i
49
49
  Result -------------------------------------------
50
50
  ruby1 ruby2
51
51
  example_single 99414.1 i/s 99723.3 i/s
@@ -76,7 +76,7 @@ benchmarks:
76
76
  you can benchmark the scripts with multiple ruby executables.
77
77
 
78
78
  ```
79
- $ exe/benchmark_driver ruby_benchmark_set/example_multi.yml -e ruby1::ruby -e ruby2::ruby
79
+ $ exe/benchmark_driver benchmarks/example_multi.yml -e ruby1::ruby -e ruby2::ruby
80
80
  benchmark results:
81
81
  Execution time (sec)
82
82
  name ruby1 ruby2
@@ -90,7 +90,7 @@ interpolation 1.002
90
90
  ```
91
91
 
92
92
  ```
93
- $ exe/benchmark_driver ruby_benchmark_set/example_multi.yml -e ruby1::ruby -e ruby2::ruby -i
93
+ $ exe/benchmark_driver benchmarks/example_multi.yml -e ruby1::ruby -e ruby2::ruby -i
94
94
  Result -------------------------------------------
95
95
  ruby1 ruby2
96
96
  join 4701954.3 i/s 4639520.3 i/s
@@ -142,7 +142,7 @@ benchmarks:
142
142
  If you have a trouble like an unexpectedly fast result, you should check benchmark script by `-v`.
143
143
 
144
144
  ```
145
- $ exe/benchmark_driver ruby_benchmark_set/example_multi.yml -v
145
+ $ exe/benchmark_driver benchmarks/example_multi.yml -v
146
146
  --- Running "join" with "ruby" 957780 times ---
147
147
  a = 'a' * 100
148
148
  b = 'b' * 100
data/Rakefile CHANGED
@@ -1,15 +1,15 @@
1
1
  require 'bundler/gem_tasks'
2
2
 
3
- desc 'Run benchmarks in ruby_benchmark_set'
4
- task :ruby_benchmark_set do
3
+ desc 'Run benchmarks in benchmarks'
4
+ task :benchmarks do
5
5
  require 'bundler'
6
6
  require 'shellwords'
7
7
 
8
- Dir.glob(File.expand_path('./ruby_benchmark_set/**/*.yml', __dir__)).sort.each do |path|
8
+ Dir.glob(File.expand_path('./benchmarks/**/*.yml', __dir__)).sort.each do |path|
9
9
  Bundler.with_clean_env do
10
10
  sh [File.expand_path('./exe/benchmark_driver', __dir__), path].shelljoin
11
11
  end
12
12
  end
13
13
  end
14
14
 
15
- task default: :ruby_benchmark_set
15
+ task default: :benchmarks
File without changes
File without changes
data/exe/benchmark_driver CHANGED
@@ -16,7 +16,7 @@ args = OptionParser.new do |o|
16
16
  end
17
17
  o.on('-i [DURATION]', '--ips [SECONDS]', "Measure IPS in duration seconds (default: #{BenchmarkDriver::DEFAULT_IPS_DURATION})") do |i|
18
18
  options[:measure_type] = 'ips'
19
- options[:measure_num] = i if i
19
+ options[:measure_num] = Integer(i) if i
20
20
  end
21
21
  o.on('-l [COUNT]', '--loop-count [COUNT]', "Measure execution time with loop count (default: #{BenchmarkDriver::DEFAULT_LOOP_COUNT})") do |l|
22
22
  options[:measure_type] = 'loop_count'
@@ -8,7 +8,7 @@ class BenchmarkDriver
8
8
  DEFAULT_IPS_DURATION = 1
9
9
 
10
10
  # @param [String] measure_type - "loop_count"|"ips"
11
- # @param [Integer] measure_num - Loop count for "loop_type", duration seconds for "ips"
11
+ # @param [Integer,nil] measure_num - Loop count for "loop_type", duration seconds for "ips"
12
12
  # @param [Array<String>] execs - ["path1", "path2"] or `["ruby1::path1", "ruby2::path2"]`
13
13
  # @param [Boolean] verbose
14
14
  def initialize(measure_type: 'loop_count', measure_num: nil, execs: ['ruby'], verbose: false)
@@ -78,7 +78,7 @@ class BenchmarkDriver
78
78
  end
79
79
 
80
80
  def measure_script(ruby, script)
81
- Tempfile.create do |f|
81
+ Tempfile.create(File.basename(__FILE__)) do |f|
82
82
  f.write(script)
83
83
  f.close
84
84
 
@@ -139,9 +139,9 @@ class BenchmarkDriver
139
139
  def overhead_script(iterations)
140
140
  <<-RUBY
141
141
  #{@prelude}
142
- i = 0
143
- while i < #{iterations}
144
- i += 1
142
+ __benchmark_driver_i = 0
143
+ while __benchmark_driver_i < #{iterations}
144
+ __benchmark_driver_i += 1
145
145
  end
146
146
  RUBY
147
147
  end
@@ -149,9 +149,9 @@ end
149
149
  def benchmark_script(iterations)
150
150
  <<-RUBY
151
151
  #{@prelude}
152
- i = 0
153
- while i < #{iterations}
154
- i += 1
152
+ __benchmark_driver_i = 0
153
+ while __benchmark_driver_i < #{iterations}
154
+ __benchmark_driver_i += 1
155
155
  #{@benchmark}
156
156
  end
157
157
  RUBY
@@ -1,3 +1,3 @@
1
1
  class BenchmarkDriver
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
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.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-26 00:00:00.000000000 Z
11
+ date: 2017-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -53,15 +53,15 @@ files:
53
53
  - README.md
54
54
  - Rakefile
55
55
  - benchmark_driver.gemspec
56
+ - benchmarks/core/array.yml
57
+ - benchmarks/example_multi.yml
58
+ - benchmarks/example_single.yml
59
+ - benchmarks/lib/erb.yml
56
60
  - bin/console
57
61
  - bin/setup
58
62
  - exe/benchmark_driver
59
63
  - lib/benchmark_driver.rb
60
64
  - lib/benchmark_driver/version.rb
61
- - ruby_benchmark_set/core/array.yml
62
- - ruby_benchmark_set/example_multi.yml
63
- - ruby_benchmark_set/example_single.yml
64
- - ruby_benchmark_set/lib/erb.yml
65
65
  homepage: https://github.com/k0kubun/benchmark_driver
66
66
  licenses:
67
67
  - MIT
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  version: '0'
83
83
  requirements: []
84
84
  rubyforge_project:
85
- rubygems_version: 2.6.11
85
+ rubygems_version: 2.6.13
86
86
  signing_key:
87
87
  specification_version: 4
88
88
  summary: Benchmark driver for different Ruby executables