You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
docuseal/vendor/bundle/ruby/4.0.0/gems/uber-0.1.0/test/builder-benchmark.rb

18 lines
451 B

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