1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix broken benchmark

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
samuel 2018-11-20 10:09:53 +00:00
parent 635dd3408f
commit 12ae8c0813

View file

@ -10,25 +10,25 @@ def make_link(previous)
end end
end end
def make_chain def make_chain(length, &block)
chain = Fiber.new do chain = Fiber.new(&block)
while true
Fiber.yield(message) (length - 1).times do
end
end
(fibers - 1).times do
chain = make_link(chain) chain = make_link(chain)
end end
return chain return chain
end end
def run_benchmark(fibers, repeats, message = :hello) def run_benchmark(length, repeats, message = :hello)
chain = nil chain = nil
time = Benchmark.realtime do time = Benchmark.realtime do
chain = make_chain chain = make_chain(length) do
while true
Fiber.yield(message)
end
end
end end
puts "Creating #{fibers} fibers took #{time}..." puts "Creating #{fibers} fibers took #{time}..."