Skip to content

Commit

Permalink
Fix broken benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Aug 10, 2018
1 parent 0044c3c commit ef7efd3
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions benchmark/bm_vm2_fiber_chain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@ def make_link(previous)
end
end

def make_chain
chain = Fiber.new do
while true
Fiber.yield(message)
end
end
def make_chain(length, &block)
chain = Fiber.new(&block)

(fibers - 1).times do
(length - 1).times do
chain = make_link(chain)
end

return chain
end

def run_benchmark(fibers, repeats, message = :hello)
def run_benchmark(length, repeats, message = :hello)
chain = nil

time = Benchmark.realtime do
chain = make_chain
chain = make_chain(length) do
while true
Fiber.yield(message)
end
end
end

puts "Creating #{fibers} fibers took #{time}..."
puts "Creating #{length} fibers took #{time}..."

time = Benchmark.realtime do
repeats.times do
Expand Down

0 comments on commit ef7efd3

Please sign in to comment.