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

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
parent 4aa44a762e
commit 995f6ee102

View file

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