summaryrefslogtreecommitdiff
path: root/benchmark/loop_generator.rb
blob: 6a3194b6700f3cec826e007980ed78cb89ef688f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
max = 6000000

if defined? Fiber
  gen = (1..max).each
  loop do
    gen.next
  end
else
  require 'generator'
  gen = Generator.new((0..max))
  while gen.next?
    gen.next
  end
end