[#70843] Re: [ruby-cvs:58952] hsbt:r51801 (trunk): * lib/rubygems: Update to RubyGems HEAD(fe61e4c112). — Eric Wong <normalperson@...>
hsbt@ruby-lang.org wrote:
3 messages
2015/09/17
[ruby-core:70702] [Ruby trunk - Feature #11518] [Open] Queue enhancement - promote! and promote_all!
From:
jonathanscruz@...
Date:
2015-09-09 15:04:59 UTC
List:
ruby-core #70702
Issue #11518 has been reported by Jonathan Cruz. ---------------------------------------- Feature #11518: Queue enhancement - promote! and promote_all! https://bugs.ruby-lang.org/issues/11518 * Author: Jonathan Cruz * Status: Open * Priority: Normal * Assignee: Yukihiro Matsumoto ---------------------------------------- I=E2=80=99m submitting a patch to enhance the Queue class by adding the met= hods Queue#promote! and Queue#promote_all!. These methods require a block t= hat accepts queue elements. Elements for which the block returns a truthy v= alue are moved to the =E2=80=98front=E2=80=99 of the queue. Queue#promote!= only applies to the first such element and Queue#promote_all! applies to a= ll matching elements (preserving their relative order). Motivation for this enhancement: Our project has several worker threads wor= king on long-running work units in a queue, trying to find a =E2=80=98match= =E2=80=99. The queue is pre-sorted with the most likely matches at the fro= nt and least likely at the back. However, there are cases where as we work = on some elements, we gain new data that certain elements are more likely to= match than we originally thought. We need a way to promote these elements = to the front of the queue. ---Files-------------------------------- ruby_queue_promote.patch (2.82 KB) --=20 https://bugs.ruby-lang.org/