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

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