ruby/benchmark/io_close_contended.yml

21 lines
398 B
YAML

prelude: |
ios = 100.times.map do
10.times.map do
pipe = IO.pipe.tap do |r, w|
Thread.new do
r.read
rescue IOError
# Ignore
end
end
end
end
benchmark:
# Close IO
io_close_contended: |
# Process each batch of ios per iteration of the benchmark.
ios.pop.each do |r, w|
r.close
w.close
end
loop_count: 10