Sha256: 0ca6ce246090662b21838db6d56ce0b84999b13188805648e52693cdba3df5a7

Contents?: true

Size: 420 Bytes

Versions: 1

Compression:

Stored size: 420 Bytes

Contents

class Foo
  attr_reader :bench_reader
  def initialize
    @bench_reader = @bench_method = 10
  end
  def bench_method
    @bench_method
  end
end

Viiite.bench do |b|
  foo = Foo.new
  b.variation_point :ruby, Viiite.which_ruby
  b.range_over([1, 100_000, 1_000_000], :runs) do |runs|
    b.report(:bench_reader){ runs.times{ foo.bench_reader } }
    b.report(:bench_method){ runs.times{ foo.bench_method } }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
viiite-0.2.0 examples/bench_attr_vs_method.rb