(前回の続き) Benchmark.benchmark (" "*11 + Benchmark::CAPTION) do |bm| (略) fib = bm.report("fiber: ") do outer.times do fiber = Fiber.new do array = Array.new(size){|i| i} idx = 0 ret = true while ret ret = Fiber.yield array[idx] idx = (idx + 1) % array.length end end sum = 0 inner.times do sum += fiber.resume(true) end fiber.resume(nil) end end end ______ / \ /\ / し (>) (<)\ | ∪ (__人__) J |