Project

General

Profile

Feature #4531 » io_select_using_poll_test.rb

contrived test case - normalperson (Eric Wong), 03/29/2011 01:59 AM

 
require "benchmark"
ios = []
nr = 1000000
max = Process.getrlimit(Process::RLIMIT_NOFILE)[0]
puts "max fd: #{max} (results not apparent with <= 1024 max fd)"

((max / 2) - 2).times do
ios.concat IO.pipe
end

last = [ ios[-1] ]
puts "last IO: #{last[0].inspect}"

p(Benchmark.measure do
nr.times do
IO.select nil, last
end
end)
puts "GC.count: #{GC.count}"
(2-2/6)