summaryrefslogtreecommitdiff
path: root/benchmark/vm_thread_pipe.yml
blob: fe4f3b816692db85247d51735c621541e5cdec4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
prelude: |
  # Measure small and plenty pipe read/write.
  # A performance may depend on GVL implementation.
benchmark:
  vm_thread_pipe: |

    lmax = 100_000
    r, w = IO.pipe
    [Thread.new{
      lmax.times{
        w.write('a')
      }
      p "w:exit"
    }, Thread.new{
      lmax.times{
        r.read(1)
      }
      p "r:exit"
    }].each{|t| t.join}
loop_count: 1