1# IO.select performance. a lot of fd
2
3ios = []
4nr = 100
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 - 10).times do
13  r, w = IO.pipe
14  r.close
15  ios.push w
16end
17
18nr.times do
19  IO.select nil, ios
20end
21
22