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
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}..."