benchmark_driver 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +97 -94
- data/Rakefile +13 -4
- data/benchmark_driver.gemspec +0 -1
- data/exe/benchmark_driver +9 -10
- data/lib/benchmark_driver.rb +77 -27
- data/lib/benchmark_driver/version.rb +1 -1
- data/ruby_benchmark_set/core/array.yml +4 -0
- data/ruby_benchmark_set/example_multi.yml +10 -0
- data/ruby_benchmark_set/example_single.yml +4 -0
- data/ruby_benchmark_set/lib/erb.yml +30 -0
- metadata +5 -18
- data/.rspec +0 -2
- data/examples/bm_app_erb.yml +0 -20
- data/examples/erb_compile_render.yml +0 -47
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 027b33623e6d71484da812d92ef6d4acbf154312
|
4
|
+
data.tar.gz: cb8da42411f02760787b766fa0d8a8622750ecd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a666e41732c84ab63b0b93460b77b01e2b1540b00199f4c71971b7da532f0531bd6daf9813c87a91f55be51fc37fd2ca12723062b294017986d9f98261df4475
|
7
|
+
data.tar.gz: ea81b5f7b48a02c99f5718ec4dff48e25dc07eede56d1194172ca209057a4d170405082907d2f3937a91779ee11a08e1dc443afbc29a355782d540923382c5a0
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# BenchmarkDriver
|
1
|
+
# BenchmarkDriver [](https://travis-ci.org/k0kubun/benchmark_driver)
|
2
2
|
|
3
3
|
Benchmark driver for different Ruby executables
|
4
4
|
|
@@ -9,155 +9,158 @@ Benchmark driver for different Ruby executables
|
|
9
9
|
## Usage
|
10
10
|
|
11
11
|
```
|
12
|
-
$ benchmark_driver -h
|
12
|
+
$ exe/benchmark_driver -h
|
13
13
|
Usage: benchmark_driver [options] [YAML]
|
14
|
-
-d, --duration [SECONDS] Duration seconds to run each benchmark (default: 1)
|
15
14
|
-e, --executables [EXECS] Ruby executables (e1::path1; e2::path2; e3::path3;...)
|
16
|
-
-
|
15
|
+
-i, --ips [SECONDS] Measure IPS in duration seconds (default: 1)
|
16
|
+
-l, --loop-count [COUNT] Measure execution time with loop count (default: 100000)
|
17
17
|
-v, --verbose
|
18
18
|
```
|
19
19
|
|
20
20
|
### Running single script
|
21
21
|
|
22
|
-
With following `
|
22
|
+
With following `example_single.yml`,
|
23
23
|
|
24
24
|
```yml
|
25
25
|
prelude: |
|
26
26
|
require 'erb'
|
27
|
-
|
28
|
-
|
29
|
-
content = "hello world!\n" * 10
|
30
|
-
|
31
|
-
data = <<EOS
|
32
|
-
<html>
|
33
|
-
<head> <%= title %> </head>
|
34
|
-
<body>
|
35
|
-
<h1> <%= title %> </h1>
|
36
|
-
<p>
|
37
|
-
<%= content %>
|
38
|
-
</p>
|
39
|
-
</body>
|
40
|
-
</html>
|
41
|
-
EOS
|
42
|
-
|
43
|
-
benchmark: |
|
44
|
-
ERB.new(data).result(binding)
|
27
|
+
erb = ERB.new(%q[Hello <%= 'World' %>])
|
28
|
+
benchmark: erb.result
|
45
29
|
```
|
46
30
|
|
47
31
|
you can benchmark the script with multiple ruby executables.
|
48
32
|
|
49
33
|
```
|
50
|
-
$ benchmark_driver
|
34
|
+
$ exe/benchmark_driver ruby_benchmark_set/example_single.yml -e ruby1::ruby -e ruby2::ruby
|
51
35
|
benchmark results:
|
52
36
|
Execution time (sec)
|
53
37
|
name ruby1 ruby2
|
54
|
-
|
38
|
+
example_single 0.958 0.972
|
55
39
|
|
56
40
|
Speedup ratio: compare with the result of `ruby1' (greater is better)
|
57
41
|
name ruby2
|
58
|
-
|
42
|
+
example_single 0.986
|
59
43
|
```
|
60
44
|
|
61
|
-
And you can change benchmark output by `-
|
45
|
+
And you can change benchmark output to IPS (iteration per second) by `-i` option.
|
62
46
|
|
63
47
|
```
|
64
|
-
$ benchmark_driver
|
48
|
+
$ exe/benchmark_driver ruby_benchmark_set/example_single.yml -e ruby1::ruby -e ruby2::ruby -i
|
65
49
|
Result -------------------------------------------
|
66
50
|
ruby1 ruby2
|
67
|
-
|
51
|
+
example_single 99414.1 i/s 99723.3 i/s
|
68
52
|
|
69
|
-
Comparison:
|
70
|
-
|
71
|
-
|
53
|
+
Comparison: example_single
|
54
|
+
ruby2: 99723.3 i/s
|
55
|
+
ruby1: 99414.1 i/s - 1.00x slower
|
72
56
|
```
|
73
57
|
|
74
58
|
### Running multiple scripts
|
75
59
|
|
76
60
|
One YAML file can contain multiple benchmark scripts.
|
77
|
-
With following `
|
61
|
+
With following `example_multi.yml`,
|
78
62
|
|
79
63
|
```yml
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
<body>
|
91
|
-
<h1> <%= title %> </h1>
|
92
|
-
<p>
|
93
|
-
<%= content %>
|
94
|
-
</p>
|
95
|
-
</body>
|
96
|
-
</html>
|
97
|
-
EOS
|
98
|
-
|
99
|
-
benchmark: |
|
100
|
-
ERB.new(data).src
|
101
|
-
|
102
|
-
- name: erb_render
|
103
|
-
prelude: |
|
104
|
-
require 'erb'
|
105
|
-
|
106
|
-
title = "hello world!"
|
107
|
-
content = "hello world!\n" * 10
|
108
|
-
|
109
|
-
data = <<EOS
|
110
|
-
<html>
|
111
|
-
<head> <%= title %> </head>
|
112
|
-
<body>
|
113
|
-
<h1> <%= title %> </h1>
|
114
|
-
<p>
|
115
|
-
<%= content %>
|
116
|
-
</p>
|
117
|
-
</body>
|
118
|
-
</html>
|
119
|
-
EOS
|
120
|
-
|
121
|
-
src = "def self.render(title, content); #{ERB.new(data).src}; end"
|
122
|
-
mod = Module.new
|
123
|
-
mod.instance_eval(src, "(ERB)")
|
124
|
-
|
125
|
-
benchmark: |
|
126
|
-
mod.render(title, content)
|
64
|
+
prelude: |
|
65
|
+
a = 'a' * 100
|
66
|
+
b = 'b' * 100
|
67
|
+
benchmarks:
|
68
|
+
- name: join
|
69
|
+
benchmark: |
|
70
|
+
[a, b].join
|
71
|
+
- name: interpolation
|
72
|
+
benchmark: |
|
73
|
+
"#{a}#{b}"
|
127
74
|
```
|
128
75
|
|
129
76
|
you can benchmark the scripts with multiple ruby executables.
|
130
77
|
|
131
78
|
```
|
132
|
-
$ benchmark_driver
|
79
|
+
$ exe/benchmark_driver ruby_benchmark_set/example_multi.yml -e ruby1::ruby -e ruby2::ruby
|
133
80
|
benchmark results:
|
134
81
|
Execution time (sec)
|
135
82
|
name ruby1 ruby2
|
136
|
-
|
137
|
-
|
83
|
+
join 0.022 0.022
|
84
|
+
interpolation 0.026 0.026
|
138
85
|
|
139
86
|
Speedup ratio: compare with the result of `ruby1' (greater is better)
|
140
87
|
name ruby2
|
141
|
-
|
142
|
-
|
88
|
+
join 1.045
|
89
|
+
interpolation 1.002
|
143
90
|
```
|
144
91
|
|
145
92
|
```
|
146
|
-
$ benchmark_driver
|
93
|
+
$ exe/benchmark_driver ruby_benchmark_set/example_multi.yml -e ruby1::ruby -e ruby2::ruby -i
|
147
94
|
Result -------------------------------------------
|
148
95
|
ruby1 ruby2
|
149
|
-
|
150
|
-
|
96
|
+
join 4701954.3 i/s 4639520.3 i/s
|
97
|
+
interpolation 4263170.0 i/s 4044083.0 i/s
|
151
98
|
|
152
|
-
Comparison:
|
153
|
-
|
154
|
-
|
99
|
+
Comparison: join
|
100
|
+
ruby1: 4701954.3 i/s
|
101
|
+
ruby2: 4639520.3 i/s - 1.01x slower
|
155
102
|
|
156
|
-
Comparison:
|
157
|
-
ruby1:
|
158
|
-
ruby2:
|
103
|
+
Comparison: interpolation
|
104
|
+
ruby1: 4263170.0 i/s
|
105
|
+
ruby2: 4044083.0 i/s - 1.05x slower
|
159
106
|
```
|
160
107
|
|
108
|
+
### Configuring modes
|
109
|
+
|
110
|
+
There are 2 modes:
|
111
|
+
|
112
|
+
- Loop count: Enabled by `-l`. Optionally you can change count to loop by `-l COUNT`.
|
113
|
+
- IPS: Enabled by `-i`. Optionally you can change duration by `-i DURATION`.
|
114
|
+
|
115
|
+
Specifying both `-l` and `-i` is nonsense.
|
116
|
+
|
117
|
+
### YAML syntax
|
118
|
+
You can specify `benchmark:` or `benchmarks:`.
|
119
|
+
|
120
|
+
#### Single
|
121
|
+
```yml
|
122
|
+
name: String # optional (default: file name)
|
123
|
+
prelude: String # optional
|
124
|
+
loop_count: Integer # optional
|
125
|
+
benchmark: String # required
|
126
|
+
```
|
127
|
+
|
128
|
+
#### Multi
|
129
|
+
|
130
|
+
```yml
|
131
|
+
prelude: String # optional (shared)
|
132
|
+
loop_count: Integer # optional (shared)
|
133
|
+
benchmarks:
|
134
|
+
- name: String # required
|
135
|
+
prelude: String # optional (benchmark specific)
|
136
|
+
loop_count: Integer # optional (benchmark specific)
|
137
|
+
benchmark: String # required
|
138
|
+
```
|
139
|
+
|
140
|
+
### Debugging
|
141
|
+
|
142
|
+
If you have a trouble like an unexpectedly fast result, you should check benchmark script by `-v`.
|
143
|
+
|
144
|
+
```
|
145
|
+
$ exe/benchmark_driver ruby_benchmark_set/example_multi.yml -v
|
146
|
+
--- Running "join" with "ruby" 957780 times ---
|
147
|
+
a = 'a' * 100
|
148
|
+
b = 'b' * 100
|
149
|
+
|
150
|
+
|
151
|
+
i = 0
|
152
|
+
while i < 957780
|
153
|
+
i += 1
|
154
|
+
[a, b].join
|
155
|
+
|
156
|
+
end
|
157
|
+
```
|
158
|
+
|
159
|
+
## TODO
|
160
|
+
|
161
|
+
- Measure multiple times and use minimum result
|
162
|
+
- Retry and reject negative result in ips mode
|
163
|
+
- Change not to take long time for iteration count estimation in ips mode
|
161
164
|
|
162
165
|
## Contributing
|
163
166
|
|
data/Rakefile
CHANGED
@@ -1,6 +1,15 @@
|
|
1
|
-
require
|
2
|
-
require "rspec/core/rake_task"
|
1
|
+
require 'bundler/gem_tasks'
|
3
2
|
|
4
|
-
|
3
|
+
desc 'Run benchmarks in ruby_benchmark_set'
|
4
|
+
task :ruby_benchmark_set do
|
5
|
+
require 'bundler'
|
6
|
+
require 'shellwords'
|
5
7
|
|
6
|
-
|
8
|
+
Dir.glob(File.expand_path('./ruby_benchmark_set/**/*.yml', __dir__)).sort.each do |path|
|
9
|
+
Bundler.with_clean_env do
|
10
|
+
sh [File.expand_path('./exe/benchmark_driver', __dir__), path].shelljoin
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
task default: :ruby_benchmark_set
|
data/benchmark_driver.gemspec
CHANGED
data/exe/benchmark_driver
CHANGED
@@ -8,17 +8,19 @@ require 'yaml'
|
|
8
8
|
options = {}
|
9
9
|
args = OptionParser.new do |o|
|
10
10
|
o.banner = "Usage: #{File.basename($0, '.*')} [options] [YAML]"
|
11
|
-
o.on('-d', '--duration [SECONDS]', 'Duration seconds to run each benchmark (default: 1)') do |n|
|
12
|
-
options[:duration] = n.to_i
|
13
|
-
end
|
14
11
|
o.on('-e', '--executables [EXECS]', 'Ruby executables (e1::path1; e2::path2; e3::path3;...)') do |e|
|
15
12
|
options[:execs] ||= []
|
16
13
|
e.split(/;/).each do |path|
|
17
14
|
options[:execs] << path
|
18
15
|
end
|
19
16
|
end
|
20
|
-
o.on('-
|
21
|
-
options[:
|
17
|
+
o.on('-i [DURATION]', '--ips [SECONDS]', "Measure IPS in duration seconds (default: #{BenchmarkDriver::DEFAULT_IPS_DURATION})") do |i|
|
18
|
+
options[:measure_type] = 'ips'
|
19
|
+
options[:measure_num] = i if i
|
20
|
+
end
|
21
|
+
o.on('-l [COUNT]', '--loop-count [COUNT]', "Measure execution time with loop count (default: #{BenchmarkDriver::DEFAULT_LOOP_COUNT})") do |l|
|
22
|
+
options[:measure_type] = 'loop_count'
|
23
|
+
options[:measure_num] = l if l
|
22
24
|
end
|
23
25
|
o.on('-v', '--verbose') do |v|
|
24
26
|
options[:verbose] = v
|
@@ -28,9 +30,6 @@ abort "No YAML file is specified" if args.empty?
|
|
28
30
|
|
29
31
|
driver = BenchmarkDriver.new(options)
|
30
32
|
args.each do |yaml|
|
31
|
-
|
32
|
-
|
33
|
-
benchmarks[:name] = File.basename(yaml, '.*')
|
34
|
-
end
|
35
|
-
driver.run(benchmarks)
|
33
|
+
default = { name: File.basename(yaml, '.*') }
|
34
|
+
driver.run(default.merge(YAML.load(File.read(yaml))))
|
36
35
|
end
|
data/lib/benchmark_driver.rb
CHANGED
@@ -3,35 +3,39 @@ require 'benchmark'
|
|
3
3
|
require 'tempfile'
|
4
4
|
|
5
5
|
class BenchmarkDriver
|
6
|
-
|
6
|
+
MEASURE_TYPES = %w[loop_count ips]
|
7
|
+
DEFAULT_LOOP_COUNT = 100_000
|
8
|
+
DEFAULT_IPS_DURATION = 1
|
9
|
+
|
10
|
+
# @param [String] measure_type - "loop_count"|"ips"
|
11
|
+
# @param [Integer] measure_num - Loop count for "loop_type", duration seconds for "ips"
|
7
12
|
# @param [Array<String>] execs - ["path1", "path2"] or `["ruby1::path1", "ruby2::path2"]`
|
8
|
-
# @param [String] result_format
|
9
13
|
# @param [Boolean] verbose
|
10
|
-
def initialize(
|
11
|
-
|
14
|
+
def initialize(measure_type: 'loop_count', measure_num: nil, execs: ['ruby'], verbose: false)
|
15
|
+
unless MEASURE_TYPES.include?(measure_type)
|
16
|
+
abort "unsupported measure type: #{measure_type.dump}"
|
17
|
+
end
|
18
|
+
@measure_type = measure_type
|
19
|
+
@measure_num = measure_num
|
12
20
|
@execs = execs.map do |exec|
|
13
21
|
name, path = exec.split('::', 2)
|
14
22
|
Executable.new(name, path || name)
|
15
23
|
end
|
16
|
-
@result_format = result_format
|
17
24
|
@verbose = verbose
|
18
25
|
end
|
19
26
|
|
20
|
-
# @param [Hash
|
21
|
-
def run(
|
22
|
-
|
23
|
-
benchmarks = hashes.map do |hash|
|
24
|
-
BenchmarkScript.new(Hash[hash.map { |k, v| [k.to_sym, v] }])
|
25
|
-
end
|
26
|
-
if benchmarks.empty?
|
27
|
-
abort 'No benchmark is specified in YAML'
|
28
|
-
end
|
27
|
+
# @param [Hash] root_hash
|
28
|
+
def run(root_hash)
|
29
|
+
root = BenchmarkRoot.new(Hash[root_hash.map { |k, v| [k.to_sym, v] }])
|
29
30
|
|
30
|
-
results = benchmarks.map do |benchmark|
|
31
|
+
results = root.benchmarks.map do |benchmark|
|
31
32
|
metrics_by_exec = {}
|
32
33
|
iterations = calc_iterations(@execs.first, benchmark)
|
33
34
|
@execs.each do |exec|
|
34
|
-
|
35
|
+
if @verbose
|
36
|
+
puts "--- Running #{benchmark.name.dump} with #{exec.name.dump} #{iterations} times ---"
|
37
|
+
puts "#{benchmark.benchmark_script(iterations)}\n"
|
38
|
+
end
|
35
39
|
elapsed_time = run_benchmark(exec, benchmark, iterations)
|
36
40
|
metrics_by_exec[exec] = BenchmarkMetrics.new(iterations, elapsed_time)
|
37
41
|
end
|
@@ -39,13 +43,13 @@ class BenchmarkDriver
|
|
39
43
|
end
|
40
44
|
puts if @verbose
|
41
45
|
|
42
|
-
case @
|
43
|
-
when '
|
44
|
-
|
46
|
+
case @measure_type
|
47
|
+
when 'loop_count'
|
48
|
+
LoopCountReporter.report(@execs, results)
|
45
49
|
when 'ips'
|
46
50
|
IpsReporter.report(@execs, results)
|
47
51
|
else
|
48
|
-
raise "
|
52
|
+
raise "unexpected measure type: #{@measure_type.dump}"
|
49
53
|
end
|
50
54
|
end
|
51
55
|
|
@@ -53,10 +57,18 @@ class BenchmarkDriver
|
|
53
57
|
|
54
58
|
# Estimate iterations to finish benchmark within `@duration`.
|
55
59
|
def calc_iterations(exec, benchmark)
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
+
case @measure_type
|
61
|
+
when 'loop_count'
|
62
|
+
@measure_num || benchmark.loop_count || DEFAULT_LOOP_COUNT
|
63
|
+
when 'ips'
|
64
|
+
# TODO: Change to try from 1, 10, 100 ...
|
65
|
+
base = 1000
|
66
|
+
time = run_benchmark(exec, benchmark, base)
|
67
|
+
duration = @measure_num || DEFAULT_IPS_DURATION
|
68
|
+
(duration / time * base).to_i
|
69
|
+
else
|
70
|
+
raise "unexpected measure type: #{@measure_type.dump}"
|
71
|
+
end
|
60
72
|
end
|
61
73
|
|
62
74
|
def run_benchmark(exec, benchmark, iterations)
|
@@ -75,17 +87,55 @@ class BenchmarkDriver
|
|
75
87
|
end
|
76
88
|
end
|
77
89
|
|
90
|
+
class BenchmarkRoot
|
91
|
+
# @param [String] name
|
92
|
+
# @param [String] prelude
|
93
|
+
# @param [Integer,nil] loop_count
|
94
|
+
# @param [String,nil] benchmark - For running single instant benchmark
|
95
|
+
# @param [Array<Hash>] benchmarks - For running multiple benchmarks
|
96
|
+
def initialize(name:, prelude: '', loop_count: nil, benchmark: nil, benchmarks: [])
|
97
|
+
if benchmark
|
98
|
+
unless benchmarks.empty?
|
99
|
+
raise ArgumentError.new("Only either :benchmark or :benchmarks can be specified")
|
100
|
+
end
|
101
|
+
@benchmarks = [BenchmarkScript.new(name: name, prelude: prelude, benchmark: benchmark)]
|
102
|
+
else
|
103
|
+
@benchmarks = benchmarks.map do |hash|
|
104
|
+
BenchmarkScript.new(Hash[hash.map { |k, v| [k.to_sym, v] }]).tap do |b|
|
105
|
+
b.inherit_root(prelude: prelude, loop_count: loop_count)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
# @return [Array<BenchmarkScript>]
|
112
|
+
attr_reader :benchmarks
|
113
|
+
end
|
114
|
+
|
78
115
|
class BenchmarkScript
|
79
116
|
# @param [String] name
|
80
117
|
# @param [String] prelude
|
81
|
-
# @param [String]
|
82
|
-
def initialize(name:, prelude: '', benchmark:)
|
118
|
+
# @param [String] benchmark
|
119
|
+
def initialize(name:, prelude: '', loop_count: nil, benchmark:)
|
83
120
|
@name = name
|
84
121
|
@prelude = prelude
|
122
|
+
@loop_count = loop_count
|
85
123
|
@benchmark = benchmark
|
86
124
|
end
|
125
|
+
|
126
|
+
# @return [String]
|
87
127
|
attr_reader :name
|
88
128
|
|
129
|
+
# @return [Integer]
|
130
|
+
attr_reader :loop_count
|
131
|
+
|
132
|
+
def inherit_root(prelude:, loop_count:)
|
133
|
+
@prelude = "#{prelude}\n#{@prelude}"
|
134
|
+
if @loop_count.nil? && loop_count
|
135
|
+
@loop_count = loop_count
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
89
139
|
def overhead_script(iterations)
|
90
140
|
<<-RUBY
|
91
141
|
#{@prelude}
|
@@ -137,7 +187,7 @@ end
|
|
137
187
|
)
|
138
188
|
end
|
139
189
|
|
140
|
-
module
|
190
|
+
module LoopCountReporter
|
141
191
|
class << self
|
142
192
|
# @param [Array<Executable>] execs
|
143
193
|
# @param [Array<BenchmarkResult>] results
|
@@ -0,0 +1,30 @@
|
|
1
|
+
prelude: |
|
2
|
+
require 'erb'
|
3
|
+
|
4
|
+
template = <<EOS
|
5
|
+
<html>
|
6
|
+
<head> <%= title %> </head>
|
7
|
+
<body>
|
8
|
+
<h1> <%= title %> </h1>
|
9
|
+
<p>
|
10
|
+
<%= content %>
|
11
|
+
</p>
|
12
|
+
</body>
|
13
|
+
</html>
|
14
|
+
EOS
|
15
|
+
|
16
|
+
title = "hello world!"
|
17
|
+
content = "hello world!\n" * 10
|
18
|
+
|
19
|
+
benchmarks:
|
20
|
+
- name: ERB compiling
|
21
|
+
benchmark: ERB.new(template)
|
22
|
+
loop_count: 10000
|
23
|
+
|
24
|
+
- name: ERB rendering
|
25
|
+
prelude: |
|
26
|
+
src = "def self.render(title, content); #{ERB.new(template).src}; end"
|
27
|
+
mod = Module.new
|
28
|
+
mod.instance_eval(src, "(ERB)")
|
29
|
+
benchmark: mod.render(title, content)
|
30
|
+
loop_count: 100000
|
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.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
description: Benchmark driver for different Ruby executables
|
56
42
|
email:
|
57
43
|
- takashikkbn@gmail.com
|
@@ -61,7 +47,6 @@ extensions: []
|
|
61
47
|
extra_rdoc_files: []
|
62
48
|
files:
|
63
49
|
- ".gitignore"
|
64
|
-
- ".rspec"
|
65
50
|
- ".travis.yml"
|
66
51
|
- Gemfile
|
67
52
|
- LICENSE.txt
|
@@ -70,11 +55,13 @@ files:
|
|
70
55
|
- benchmark_driver.gemspec
|
71
56
|
- bin/console
|
72
57
|
- bin/setup
|
73
|
-
- examples/bm_app_erb.yml
|
74
|
-
- examples/erb_compile_render.yml
|
75
58
|
- exe/benchmark_driver
|
76
59
|
- lib/benchmark_driver.rb
|
77
60
|
- 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
|
78
65
|
homepage: https://github.com/k0kubun/benchmark_driver
|
79
66
|
licenses:
|
80
67
|
- MIT
|
data/.rspec
DELETED
data/examples/bm_app_erb.yml
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
prelude: |
|
2
|
-
require 'erb'
|
3
|
-
|
4
|
-
title = "hello world!"
|
5
|
-
content = "hello world!\n" * 10
|
6
|
-
|
7
|
-
data = <<EOS
|
8
|
-
<html>
|
9
|
-
<head> <%= title %> </head>
|
10
|
-
<body>
|
11
|
-
<h1> <%= title %> </h1>
|
12
|
-
<p>
|
13
|
-
<%= content %>
|
14
|
-
</p>
|
15
|
-
</body>
|
16
|
-
</html>
|
17
|
-
EOS
|
18
|
-
|
19
|
-
benchmark: |
|
20
|
-
ERB.new(data).result(binding)
|
@@ -1,47 +0,0 @@
|
|
1
|
-
- name: erb_compile
|
2
|
-
prelude: |
|
3
|
-
require 'erb'
|
4
|
-
|
5
|
-
title = "hello world!"
|
6
|
-
content = "hello world!\n" * 10
|
7
|
-
|
8
|
-
data = <<EOS
|
9
|
-
<html>
|
10
|
-
<head> <%= title %> </head>
|
11
|
-
<body>
|
12
|
-
<h1> <%= title %> </h1>
|
13
|
-
<p>
|
14
|
-
<%= content %>
|
15
|
-
</p>
|
16
|
-
</body>
|
17
|
-
</html>
|
18
|
-
EOS
|
19
|
-
|
20
|
-
benchmark: |
|
21
|
-
ERB.new(data).src
|
22
|
-
|
23
|
-
- name: erb_render
|
24
|
-
prelude: |
|
25
|
-
require 'erb'
|
26
|
-
|
27
|
-
title = "hello world!"
|
28
|
-
content = "hello world!\n" * 10
|
29
|
-
|
30
|
-
data = <<EOS
|
31
|
-
<html>
|
32
|
-
<head> <%= title %> </head>
|
33
|
-
<body>
|
34
|
-
<h1> <%= title %> </h1>
|
35
|
-
<p>
|
36
|
-
<%= content %>
|
37
|
-
</p>
|
38
|
-
</body>
|
39
|
-
</html>
|
40
|
-
EOS
|
41
|
-
|
42
|
-
src = "def self.render(title, content); #{ERB.new(data).src}; end"
|
43
|
-
mod = Module.new
|
44
|
-
mod.instance_eval(src, "(ERB)")
|
45
|
-
|
46
|
-
benchmark: |
|
47
|
-
mod.render(title, content)
|