summaryrefslogtreecommitdiff
path: root/benchmark/io_select3.yml
blob: c97d0e0cd10cbbf722e5032788e3166bb8dc56e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
prelude: |
  # IO.select performance. a lot of fd
benchmark:
  io_select3: |

    ios = []
    nr = 100
    if defined?(Process::RLIMIT_NOFILE)
      max = Process.getrlimit(Process::RLIMIT_NOFILE)[0]
    else
      max = 64
    end
    puts "max fd: #{max} (results not apparent with <= 1024 max fd)"

    (max - 10).times do
      r, w = IO.pipe
      r.close
      ios.push w
    end

    nr.times do
      IO.select nil, ios
    end
loop_count: 1