lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <>
Subject Re: Optimization of memory usage in PriorityQueue
Date Mon, 22 Jun 2009 14:05:58 GMT
On Mon, Jun 22, 2009 at 9:40 AM, Shai Erera<> wrote:
>> Though, are Lucene's core collectors reusable?  If you did really want
>> say 100K results out of each search (very unusual), it'd be nice to
>> not have to throw away the Collector/PQ each time.
> PQ has clear(), but it does not really allow you to reuse it, it just
> removes all the elements. So if we want to reuse a PQ, then we need to add a
> reset() (with a default impl of calling clear()) to both TSDC and PQ. TSDC
> will delegate the call to PQ, which is actually HitQueue, which will iterate
> on all the elements and reset them to sentinel values.
> TopFieldCollector's reset() will do the same, delegating the call to its own
> PQ (FieldValueHitQueue), which will do nothing (call clear()).
> Do you think it's worth it? If so, should we also add reset() to Collector?

Seems like it'd be good to have the option?  But it's certainly a very
expert thing since it's presumably rare that one makes such a large
queue to make re-use worthwhile.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message