Sha256: 42e475fc14bd05e2e4df09ad5d4c01b2fbdd50ce44ae336ff681208c00dadb81

Contents?: true

Size: 210 Bytes

Versions: 13

Compression:

Stored size: 210 Bytes

Contents

require 'benchmark'
NUM = 10_000_000
Benchmark.bm(60) do |b|
  it = [4,6]
  b.report("[]") do
    NUM.times do 
      it[0]
    end
  end
  b.report("at") do
    NUM.times do 
      it.at(0)
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
gamebox-0.5.5 script/perf_array_access.rb
gamebox-0.5.4 script/perf_array_access.rb
gamebox-0.5.2 script/perf_array_access.rb
gamebox-0.5.1 script/perf_array_access.rb
gamebox-0.5.0 script/perf_array_access.rb
gamebox-0.4.1 script/perf_array_access.rb
gamebox-0.4.0 script/perf_array_access.rb
gamebox-0.4.0.rc11 script/perf_array_access.rb
gamebox-0.4.0.rc5 script/perf_array_access.rb
gamebox-0.4.0.rc4 script/perf_array_access.rb
gamebox-0.4.0.rc3 script/perf_array_access.rb
gamebox-0.4.0.rc2 script/perf_array_access.rb
gamebox-0.4.0.rc1 script/perf_array_access.rb