From: Christopher Dicely Date: 2009-10-02T09:26:23+09:00 Subject: Re: Control of Priority Queue Order? And size limits on queues? On Wed, Sep 30, 2009 at 1:50 PM, Mason Kelsey wrote: > But for future use, is there a way to force the Priority Queue to always add > the newest matching item in front of the older matching items? Wouldn't that stop being a priority queue and be a priority stack? > I've noticed that searching the PriorityQueue for a matching value item is > very slow in Ruby. A Priority Queue is not an ideal structure for searching, its designed for the use where you are going to be pulling stuff off in order of priority and, within priorities, order received. If you want something that is optimized for searching for matches, you need a different structure; if you just need equality matching on the value (or part of a composite value), you can probably use a Ruby Hash, otherwise, you may need something special.