diff options
Diffstat (limited to 'jni/ruby/benchmark/bm_loop_generator.rb')
-rw-r--r-- | jni/ruby/benchmark/bm_loop_generator.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/jni/ruby/benchmark/bm_loop_generator.rb b/jni/ruby/benchmark/bm_loop_generator.rb new file mode 100644 index 0000000..d3375c7 --- /dev/null +++ b/jni/ruby/benchmark/bm_loop_generator.rb @@ -0,0 +1,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 |