summaryrefslogtreecommitdiff
path: root/benchmark/vm_thread_queue.yml
blob: 1294ad3a138c90a1bf69f6ff8c3b2790a67e15e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
benchmark:
  vm_thread_queue: |
    require 'thread'

    n = 1_000_000
    q = Thread::Queue.new
    consumer = Thread.new{
      while q.pop
        # consuming
      end
    }

    producer = Thread.new{
      n.times{
        q.push true
      }
      q.push nil
    }

    consumer.join
loop_count: 1