lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Willnauer <simon.willna...@googlemail.com>
Subject Re: Optimization of memory usage in PriorityQueue
Date Tue, 23 Jun 2009 20:05:38 GMT
See r787628

--- lucene/java/trunk/src/java/org/apache/lucene/search/FieldValueHitQueue.java
(original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/FieldValueHitQueue.java
Tue Jun 23 10:48:55 2009
@@ -173,6 +173,9 @@
  /**
   * Creates a hit queue sorted by the given list of fields.
   *
+   * <p><b>NOTE</b>: The instances returned by this method
+   * pre-allocate a full array of length <code>numHits</code>.
+   *
   * @param fields
   *          SortField array we are sorting by in priority order (highest
   *          priority first); cannot be <code>null</code> or empty

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/HitQueue.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/HitQueue.java?rev=787628&r1=787627&r2=787628&view=diff

you looked at the 2.4.1 javadoc.

simon

On Tue, Jun 23, 2009 at 9:58 PM, Claudio .<spciclista@hotmail.com> wrote:
> Hi Mike,
>
> I looked at in javadoc:
>
> http://lucene.apache.org/java/2_4_1/api/core/org/apache/lucene/search/Searcher.html#search(org.apache.lucene.search.Query,%20org.apache.lucene.search.Filter,%20int)
>
> and in trunk version of Lucene and I did not find your NOTE.
> Can you confirm?
> Thanks!
>
>
>> Date: Tue, 23 Jun 2009 06:49:00 -0400
>> Subject: Re: Optimization of memory usage in PriorityQueue
>> From: lucene@mikemccandless.com
>> To: java-dev@lucene.apache.org
>>
>> OK I've added a NOTE to the javadocs for this...
>>
>> Mike
>>
>> On Mon, Jun 22, 2009 at 8:57 PM, Claudio .<spciclista@hotmail.com> wrote:
>> >>> I think the common use case of TopScoreDocCollector is to request 10
>> >>> results, then ask for 20 and so on. You ask for N results because you
>> >>> want
>> >>> to display them, or manipulate them in some way.
>> >
>> >>> However, if we do add this to the base PQ, it means an extra check for
>> >>> every put() call. We've tried very hard recently to remove 'if' checks
>> >>> in
>> >>> TopScoreDocCollector and TopFieldCollector, so adding one back does
>> >>> not seem
>> >>> very appealing to me, especially since I IMO the use case of
>> >>> requesting 10K
>> >>> results w/o knowing first there are more or so that match the query,
>> >>> is not
>> >>> so common.
>> >
>> > Hi serera,
>> >
>> > Ok, I understood.
>> > I think the Lucene team could add a warning in the javadoc, warning that
>> > will be created internally an Object[] with the size of top.
>> > I thought that the Lucene would create internally an array with the
>> > number
>> > of results.
>> > The users can set high values of top (like me) without knowing that they
>> > are
>> > wasting memory.
>> > Thanks!
>> >
>> > ________________________________
>> > check out the rest of the Windows Live™. More than mail–Windows Live™
>> > goes
>> > way beyond your inbox. More than messages
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-dev-help@lucene.apache.org
>>
>
> ________________________________
> See all the ways you can stay connected to friends and family

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message