Sha256: 38b9c4e13e90f3e3a9ce1aec2f35b5173d3b578c1efc332dbe95777795f137e9

Contents?: true

Size: 967 Bytes

Versions: 4

Compression:

Stored size: 967 Bytes

Contents

#!/usr/bin/env ruby

require 'bullshit'
require 'protocol'

class MethodParserBenchmark < Bullshit::RepeatCase
  include Protocol

  class Foo
    def foo(a, b = nil, *c)
      if false then ; end
      if false then ; end
      if false then ; end
      yield
    end
  end

  warmup              yes

  iterations          500

  truncate_data do
    alpha_level 0.05
    window_size 10
    slope_angle 0.003
  end

  output_dir File.join(File.dirname(__FILE__), 'data')
  data_file  yes
  histogram  yes

  autocorrelation do
    alpha_level 0.05
    max_lags    50
    file        yes
  end

  def benchmark_standard
    @mp = MethodParser.new(Foo, :foo)
  end

  def after_standard
    @mp.args == [ :a, :b, :'*c', :'&block' ] or raise "wrong result"
  end

  def benchmark_nocache
    @mp = MethodParser.new(Foo, :foo)
  end

  def after_nocache
    @mp.args == [ :a, :b, :'*c', :'&block' ] or raise "wrong result"
    MethodParser.flush_source_cache
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
protocol-2.0.1 benchmarks/method_parser.rb
protocol-2.0.0 benchmarks/method_parser.rb
protocol-1.0.1 benchmarks/method_parser.rb
protocol-1.0.0 benchmarks/method_parser.rb