aboutsummaryrefslogtreecommitdiffstats
path: root/benchmark/vm_thread_queue.yml
diff options
context:
space:
mode:
Diffstat (limited to 'benchmark/vm_thread_queue.yml')
-rw-r--r--benchmark/vm_thread_queue.yml21
1 files changed, 21 insertions, 0 deletions
diff --git a/benchmark/vm_thread_queue.yml b/benchmark/vm_thread_queue.yml
new file mode 100644
index 0000000000..1294ad3a13
--- /dev/null
+++ b/benchmark/vm_thread_queue.yml
@@ -0,0 +1,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