1# Mesure small and plenty pipe read/write.
2# A performance may depend on GVL implementation.
3
4lmax = 100_000
5r, w = IO.pipe
6[Thread.new{
7  lmax.times{
8    w.write('a')
9  }
10  p "w:exit"
11}, Thread.new{
12  lmax.times{
13    r.read(1)
14  }
15  p "r:exit"
16}].each{|t| t.join}
17
18