1# IO.select performance. worst case of single fd. 2 3ios = [] 4nr = 1000000 5if defined?(Process::RLIMIT_NOFILE) 6 max = Process.getrlimit(Process::RLIMIT_NOFILE)[0] 7else 8 max = 64 9end 10puts "max fd: #{max} (results not apparent with <= 1024 max fd)" 11 12((max / 2) - 10).times do 13 ios.concat IO.pipe 14end 15 16last = [ ios[-1] ] 17puts "last IO: #{last[0].inspect}" 18 19nr.times do 20 IO.select nil, last 21end 22 23