Sha256: 6e718946f7e65de27df413a5b9e951dd4d51e0782e5884fbcbc43ca1f297c949

Contents?: true

Size: 306 Bytes

Versions: 6

Compression:

Stored size: 306 Bytes

Contents

module BmBlockVsYield
  def self._block(&block)
    block.call
  end

  def self._yield
    yield
  end
end

Benchmark.ips do |x|
  x.warmup = 10
  x.time = 60

  x.report('block') do
    BmBlockVsYield._block { 1+1 }
  end

  x.report('yield') do
    BmBlockVsYield._yield { 1+1 }
  end

  x.compare!
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
opal-1.8.3.rc1 benchmark-ips/bm_block_vs_yield.rb
opal-1.8.2 benchmark-ips/bm_block_vs_yield.rb
opal-1.8.1 benchmark-ips/bm_block_vs_yield.rb
opal-1.8.0 benchmark-ips/bm_block_vs_yield.rb
opal-1.8.0.beta1 benchmark-ips/bm_block_vs_yield.rb
opal-1.8.0.alpha1 benchmark-ips/bm_block_vs_yield.rb