Sha256: 9bc4ab7bb886c0fd545b8b2791b127523bd05d864a7c2041ddba412c679f5fac
Contents?: true
Size: 800 Bytes
Versions: 1
Compression:
Stored size: 800 Bytes
Contents
Bundler.require(:benchmarks) class PlainRubyTest attr_reader :foo, :bar def initialize(foo:, bar:) @foo = foo @bar = bar end end require "dry-initializer" class DryTest extend Dry::Initializer option :foo option :bar end require "anima" class AnimaTest include Anima.new(:foo, :bar) end require "kwattr" class KwattrTest kwattr :foo, :bar end puts "Benchmark for instantiation without options" Benchmark.ips do |x| x.config time: 15, warmup: 10 x.report("plain Ruby") do PlainRubyTest.new foo: "FOO", bar: "BAR" end x.report("dry-initializer") do DryTest.new foo: "FOO", bar: "BAR" end x.report("anima") do AnimaTest.new foo: "FOO", bar: "BAR" end x.report("kwattr") do KwattrTest.new foo: "FOO", bar: "BAR" end x.compare! end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dry-initializer-0.0.1 | benchmarks/without_options.rb |