Feature #4531 » 0001-add-io-wait-benchmarks.patch
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
|
- « Previous
- 1
- …
- 4
- 5
- 6
- Next »