README.md in benchmark_driver-0.6.2 vs README.md in benchmark_driver-0.7.0
- old
+ new
@@ -40,13 +40,13 @@
This interface is compatible with `Benchmark.bm` and `Benchmark.ips`, so it's good for migration.
```rb
require 'benchmark/driver'
require 'active_support/all'
-array = []
Benchmark.driver do |x|
+ array = []
x.report('blank?') { array.blank? }
x.report('empty?') { array.empty? }
x.compare!
end
```
@@ -55,34 +55,28 @@
This interface generates code to profile with low overhead and executes it.
```rb
require 'benchmark/driver'
+require 'active_support/all'
Benchmark.driver do |x|
- x.prelude = <<~RUBY
- require 'active_support/all'
- array = []
- RUBY
-
- x.report('blank?', script: 'array.blank?')
- x.report('empty?', script: 'array.empty?')
+ x.prelude %{ array = [] }
+ x.report 'blank?', %{ array.blank? }
+ x.report 'empty?', %{ array.empty? }
end
```
or simply:
```rb
require 'benchmark/driver'
+require 'active_support/all'
Benchmark.driver do |x|
- x.prelude = <<~RUBY
- require 'active_support/all'
- array = []
- RUBY
-
- x.report(script: 'array.blank?')
- x.report(script: 'array.empty?')
+ x.prelude %{ array = [] }
+ x.report %{ array.blank?' }
+ x.report %{ array.empty?' }
end
```
### Structured YAML Input