Sha256: 7cdb2ddb7eb3061099c91f30e82989a4bc6e5e98a2e78e33480e47fd11680f9a

Contents?: true

Size: 296 Bytes

Versions: 60

Compression:

Stored size: 296 Bytes

Contents

require 'benchmark'

TEST_AMOUNT = 1_000_000
Benchmark.bm(15) do |x|

  x.report('empty_array') do
    empty_array = []
    TEST_AMOUNT.times do
      empty_array.each{|e|}
    end
  end

  x.report('proc call') do
    block = proc {}
    TEST_AMOUNT.times do
      block.call
    end
  end

end

Version data entries

60 entries across 60 versions & 2 rubygems

Version Path
rack-app-7.3.2 spike/array_vs_proc.rb
rack-app-7.3.1 spike/array_vs_proc.rb
rack-app-7.3.0 spike/array_vs_proc.rb
rack-app-7.2.2 spike/array_vs_proc.rb
rack-app-7.2.1 spike/array_vs_proc.rb
rack-app-7.2.0 spike/array_vs_proc.rb
rack-app-7.1.0 spike/array_vs_proc.rb
rack-app-7.0.0 spike/array_vs_proc.rb
rack-app-6.8.0 spike/array_vs_proc.rb
rack-app-6.7.1 spike/array_vs_proc.rb
rack-app-6.7.0 spike/array_vs_proc.rb
rack-app-6.6.0 spike/array_vs_proc.rb
rack-app-6.5.0 spike/array_vs_proc.rb
rack-app-6.4.1 spike/array_vs_proc.rb
rack-app-6.4.0 spike/array_vs_proc.rb
rack-app-6.3.3 spike/array_vs_proc.rb
rack-app-6.3.2 spike/array_vs_proc.rb
rack-app-6.3.1 spike/array_vs_proc.rb
rack-app-6.3.0 spike/array_vs_proc.rb
rack-app-6.2.0 spike/array_vs_proc.rb