Project

General

Profile

Feature #4531 » 0001-add-io-wait-benchmarks.patch

normalperson (Eric Wong), 05/05/2011 06:53 AM

View differences:

benchmark/bm_io_wait.rb
# IO#wait performance
require "io/wait"
r, w = IO.pipe
w.syswrite '.'
nr = 1000000
nr.times {
r.wait
}
benchmark/bm_io_wait2.rb
# IO#wait performance. worst case of single fd.
require "io/wait"
ios = []
nr = 1000000
max = Process.getrlimit(Process::RLIMIT_NOFILE)[0]
puts "max fd: #{max} (results not apparent with <= 1024 max fd)"
((max / 2) - 11).times do
ios.concat IO.pipe
end
r, w = IO.pipe
w.syswrite '.'
puts "last IO: #{r.inspect}"
nr.times do
r.wait
end
(6-6/6)