Fix code climate cognitive complexity issue

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
samuel 2018-11-20 10:06:58 +00:00
Родитель 4aa44a762e
Коммит 995f6ee102
1 изменённых файлов: 15 добавлений и 9 удалений

Просмотреть файл

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