Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 33 lines (31 sloc) 0.64 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
perf_test('new') do
  i = 0
  while i < 1000000
    b = {}
    c = {1 => i}
    d = {1 => i, 2 => i}
    i += 1
  end
end

perf_test('[]') do
  i = 0
  a = {0=>:zero, 1=>:un, 2=>:deux, 3=>:trois, 4=>:quatre}
  while i < 1000000
    a[0]; a[1]; a[2]; a[3]; a[4]
    a[0]; a[1]; a[2]; a[3]; a[4]
    a[0]; a[1]; a[2]; a[3]; a[4]
    a[0]; a[1]; a[2]; a[3]; a[4]
    i += 1
  end
end

perf_test('[]=') do
  i = 0
  a = {}
  while i < 1000000
    a[0] = a[1] = a[2] = a[3] = a[4] = i + 1
    a[0] = a[1] = a[2] = a[3] = a[4] = i - 1
    a[0] = a[1] = a[2] = a[3] = a[4] = i + 1
    a[0] = a[1] = a[2] = a[3] = a[4] = i - 1
    i += 1
  end
end
Something went wrong with that request. Please try again.