Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 2678 invoked from network); 22 Jun 2009 14:06:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 22 Jun 2009 14:06:18 -0000 Received: (qmail 55710 invoked by uid 500); 22 Jun 2009 14:06:28 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 55624 invoked by uid 500); 22 Jun 2009 14:06:28 -0000 Mailing-List: contact java-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-dev@lucene.apache.org Received: (qmail 55616 invoked by uid 99); 22 Jun 2009 14:06:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Jun 2009 14:06:28 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [74.125.46.28] (HELO yw-out-2324.google.com) (74.125.46.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Jun 2009 14:06:20 +0000 Received: by yw-out-2324.google.com with SMTP id 2so1277988ywt.5 for ; Mon, 22 Jun 2009 07:05:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.151.137.8 with SMTP id p8mr11417934ybn.56.1245679558796; Mon, 22 Jun 2009 07:05:58 -0700 (PDT) In-Reply-To: <786fde50906220640s1d91e819y9605999b1a50f9e1@mail.gmail.com> References: <786fde50906220025u6756b56cnf56a4b48b403e345@mail.gmail.com> <9ac0c6aa0906220229t1f9b0d26n53c154f719cc727d@mail.gmail.com> <786fde50906220640s1d91e819y9605999b1a50f9e1@mail.gmail.com> Date: Mon, 22 Jun 2009 10:05:58 -0400 Message-ID: <9ac0c6aa0906220705x298e375vcd18cbb5f4b3a4ac@mail.gmail.com> Subject: Re: Optimization of memory usage in PriorityQueue From: Michael McCandless To: java-dev@lucene.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Mon, Jun 22, 2009 at 9:40 AM, Shai Erera wrote: >> Though, are Lucene's core collectors reusable? =A0If 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 ad= d a > reset() (with a default impl of calling clear()) to both TSDC and PQ. TSD= C > will delegate the call to PQ, which is actually HitQueue, which will iter= ate > 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 Collecto= r? 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. Mike --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org