Sha256: 448524ed9ecaa997c63f4650d09d9929c16f2b4b89bd63c138d11845157aa372
Contents?: true
Size: 944 Bytes
Versions: 22
Compression:
Stored size: 944 Bytes
Contents
Bundler.require(:benchmarks) require "dry-initializer" class NoOptsTest extend Dry::Initializer::Mixin param :foo option :bar end class DefaultsTest extend Dry::Initializer::Mixin param :foo, default: proc { "FOO" } option :bar, default: proc { "BAR" } end class TypesTest extend Dry::Initializer::Mixin param :foo, type: String option :bar, type: String end class DefaultsAndTypesTest extend Dry::Initializer::Mixin param :foo, type: String, default: proc { "FOO" } option :bar, type: String, default: proc { "BAR" } end puts "Benchmark for various options" Benchmark.ips do |x| x.config time: 15, warmup: 10 x.report("no opts") do NoOptsTest.new "foo", bar: "bar" end x.report("with defaults") do DefaultsTest.new end x.report("with types") do TypesTest.new "foo", bar: "bar" end x.report("with defaults and types") do DefaultsAndTypesTest.new end x.compare! end
Version data entries
22 entries across 22 versions & 1 rubygems