From: ko1@... Date: 2017-05-19T06:39:37+00:00 Subject: [ruby-core:81248] [Ruby trunk Feature#13552] [PATCH 0/2] reimplement ConditionVariable, Queue, SizedQueue using ccan/list Issue #13552 has been updated by ko1 (Koichi Sasada). > https://80x24.org/spew/20170519034419.GA29820@whir/raw Thank you. Adding `const` helps us to recognize. ``` PACKED_STRUCT_UNALIGNED(struct rb_queue { struct list_head waitq; const VALUE que; int num_waiting; }); ``` > I'm not sure how this helps performance, however. The Arrays > are constantly changing with push/pop and RGenGC works best for > stable (unchanging) objects (correct?) Sorry, I can't understand your question. Could you give me your question in other words? > Also, does setting RUBY_TYPED_WB_PROTECTED make sense for > rb_condvar and rb_mutex_t? They store no Ruby objects and > have no dmark callback. Yes, please. not wb protected objects become roots for all of minor gc. No write is the best wb protected object. ---------------------------------------- Feature #13552: [PATCH 0/2] reimplement ConditionVariable, Queue, SizedQueue using ccan/list https://bugs.ruby-lang.org/issues/13552#change-64908 * Author: normalperson (Eric Wong) * Status: Assigned * Priority: Normal * Assignee: normalperson (Eric Wong) * Target version: 2.5 ---------------------------------------- ``` The performance improvement increases as the number of waiters increases, due to avoiding the O(n) behavior of rb_ary_delete on the waiting thread. Uncontended queues and condition variables performance is not altered significantly. Function entry cost is slightly increased for ConditionVariable, since the data pointer is separately allocated and not embedded into the RVALUE slot. name |trunk |built ----------------------|------:|------: vm_thread_condvar1 | 0.858| 0.858 vm_thread_condvar2 | 1.003| 0.804 vm_thread_queue | 0.131| 0.129 vm_thread_sized_queue | 0.265| 0.251 vm_thread_sized_queue2| 0.892| 0.859 vm_thread_sized_queue3| 0.879| 0.845 vm_thread_sized_queue4| 0.599| 0.486 Speedup ratio: compare with the result of `trunk' (greater is better) name |built ----------------------|------: vm_thread_condvar1 | 0.999 vm_thread_condvar2 | 1.246 vm_thread_queue | 1.020 vm_thread_sized_queue | 1.057 vm_thread_sized_queue2| 1.039 vm_thread_sized_queue3| 1.041 vm_thread_sized_queue4| 1.233 ``` ---Files-------------------------------- 0001-thread_sync.c-rename-mutex_waiter-struct-to-sync_wai.patch (1.63 KB) 0002-thread_sync.c-rewrite-the-rest-using-using-ccan-list.patch (21.3 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: