File: builder-benchmark.rb

package info (click to toggle)
ruby-uber 0.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 216 kB
  • sloc: ruby: 466; makefile: 4
file content (17 lines) | stat: -rw-r--r-- 451 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require "test_helper"
require "uber/options"
require "uber/option"
require "benchmark/ips"

proc = ->(options) { "great" }

value  = Uber::Options::Value.new(proc)
option = Uber::Option[proc, instance_exec: true]

Benchmark.ips do |x|
  x.report(:value)  { value.(self, {}) }
  x.report(:option) { option.(self, {}) }
end

#  value    946.110k (± 2.4%) i/s -      4.766M in   5.040395s
# option      1.583M (± 1.6%) i/s -      7.928M in   5.009953s