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:
parent
635dd3408f
commit
12ae8c0813
1 changed files with 10 additions and 10 deletions
|
@ -10,25 +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
|
||||
def make_chain(length, &block)
|
||||
chain = Fiber.new(&block)
|
||||
|
||||
(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}..."
|
||||
|
|
Loading…
Reference in a new issue