benchmark_driver 0.6.0 → 0.6.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
  SHA256:
3
- metadata.gz: 47b335872c19aca072e3990d807767428113c3f57fb7b701fd6df4769c94ecf2
4
- data.tar.gz: e1a86a2541e681b2a04db79912da4c079426dd3aa843bc0959edf3321d2fe768
3
+ metadata.gz: 38e9cc1bf336f881a4fc545120cb2203159ac9a5daf7330e7cb0bceb1eeacd42
4
+ data.tar.gz: ee7acb4616b4296164adad96e0118496a02b3d4cf2fe90441dd932d329613cb8
5
5
  SHA512:
6
- metadata.gz: e015bc42e98d81dbb6c855159ecee0367fcb2f737b5c0d37dff43bd972c456d97c79c9c00c00034d153fdb1471f3f71cf55ab3a1b0d5e185d1d6d56fdb59ec96
7
- data.tar.gz: bd31b303ef412073906c287b977ac82c4813260239b334824ce419dd3140bfbb76861e3280dee091b41dc1ae2d9fe1cd75cc6234dc5c4e1631c7809a5f27fb3a
6
+ metadata.gz: 12eec26e9a0f747120ffe1a13aeb75bbe5aac4d9b96d4b8c5ddb01b1998f849ce2c570d5db486144ef3b622a7548a1e5adb040159993923b2dbc60de9e2053c0
7
+ data.tar.gz: 790cc1ef422e7eebd2f2a83de6c1feeea6d8f313f28042c15350f8a36019dce706605fc3c1a00728c7b31023586395f99a06ceeb6cc28421cb69ad8eed1eec99
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v0.6.1
2
+
3
+ - Support markdown output
4
+
1
5
  # v0.6.0
2
6
 
3
7
  - Drop support of Ruby interface
data/bin/bench ADDED
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+ exec bundle exec exe/benchmark-driver \
3
+ --compare \
4
+ $@
data/exe/benchmark-driver CHANGED
@@ -32,7 +32,7 @@ parser = OptionParser.new do |o|
32
32
  options[:execs] << Benchmark::Driver::Configuration::Executable.new(version, [path, *args])
33
33
  end
34
34
  end
35
- o.on('-o', '--output [TYPE]', 'Specify output type (ips, time, memory)') do |t|
35
+ o.on('-o', '--output [TYPE]', 'Specify output type (ips, time, memory, markdown)') do |t|
36
36
  abort '-o, --output must take argument but not given' if t.nil?
37
37
  options[:output] = t
38
38
  end
@@ -1,5 +1,5 @@
1
1
  module Benchmark
2
2
  module Driver
3
- VERSION = '0.6.0'
3
+ VERSION = '0.6.1'
4
4
  end
5
5
  end
@@ -12,5 +12,6 @@ module Benchmark::Output
12
12
  end
13
13
 
14
14
  require 'benchmark/output/ips'
15
+ require 'benchmark/output/markdown'
15
16
  require 'benchmark/output/memory'
16
17
  require 'benchmark/output/time'
@@ -0,0 +1,73 @@
1
+ class Benchmark::Output::Markdown
2
+ # This class requires runner to measure following fields in `Benchmark::Driver::BenchmarkResult` to show output.
3
+ REQUIRED_FIELDS = [:real]
4
+
5
+ # @param [Array<Benchmark::Driver::Configuration::Job>] jobs
6
+ # @param [Array<Benchmark::Driver::Configuration::Executable>] executables
7
+ # @param [Benchmark::Driver::Configuration::OutputOptions] options
8
+ def initialize(jobs:, executables:, options:)
9
+ @jobs = jobs
10
+ @executables = executables
11
+ @options = options
12
+ @name_length = jobs.map { |j| j.name.size }.max
13
+ end
14
+
15
+ def start_warming
16
+ $stdout.print 'warming up...'
17
+ end
18
+
19
+ # @param [String] name
20
+ def warming(name)
21
+ # noop
22
+ end
23
+
24
+ # @param [Benchmark::Driver::BenchmarkResult] result
25
+ def warmup_stats(result)
26
+ $stdout.print '.'
27
+ end
28
+
29
+ def start_running
30
+ $stdout.puts if @jobs.any?(&:warmup_needed?)
31
+
32
+ $stdout.print("|#{' ' * @name_length}|")
33
+ @executables.each do |executable|
34
+ $stdout.print('%-10s |' % executable.name)
35
+ end
36
+ $stdout.puts
37
+
38
+ $stdout.print("|:#{'-' * (@name_length-1)}|")
39
+ @executables.each do |executable|
40
+ $stdout.print(":#{'-' * 10}|")
41
+ end
42
+ $stdout.puts
43
+ end
44
+
45
+ # @param [String] name
46
+ def running(name)
47
+ $stdout.print("|%-#{@name_length}s|" % name)
48
+ @ran_num = 0
49
+ end
50
+
51
+ # @param [Benchmark::Driver::BenchmarkResult] result
52
+ def benchmark_stats(result)
53
+ if @options.compare
54
+ if @ran_num == 0
55
+ @base_real = result.real
56
+ $stdout.print('%-10.2f |' % 1)
57
+ else
58
+ $stdout.print('%-10.2f |' % (@base_real / result.real))
59
+ end
60
+ else
61
+ $stdout.print('%-10.3f |' % result.real)
62
+ end
63
+
64
+ @ran_num += 1
65
+ if @ran_num == @executables.size
66
+ $stdout.puts
67
+ end
68
+ end
69
+
70
+ def finish
71
+ # compare is done in table
72
+ end
73
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: benchmark_driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
@@ -54,6 +54,7 @@ files:
54
54
  - README.md
55
55
  - Rakefile
56
56
  - benchmark_driver.gemspec
57
+ - bin/bench
57
58
  - bin/console
58
59
  - bin/setup
59
60
  - examples/yaml/array_duration_time.yml
@@ -78,6 +79,7 @@ files:
78
79
  - lib/benchmark/driver/yaml_parser.rb
79
80
  - lib/benchmark/output.rb
80
81
  - lib/benchmark/output/ips.rb
82
+ - lib/benchmark/output/markdown.rb
81
83
  - lib/benchmark/output/memory.rb
82
84
  - lib/benchmark/output/time.rb
83
85
  - lib/benchmark/runner.rb