lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: HitQueue.getSentinelObject() and performance
Date Fri, 20 Jan 2017 16:23:30 GMT
It's curious that you see this as a hot spot.

Are you collecting a very large top N docs, relative to how many hits
the queries match, maybe?

I don't think we can make this a static instance: the collection
process will re-use the entry it pulls out of the queue.

Mike McCandless

http://blog.mikemccandless.com


On Fri, Jan 20, 2017 at 10:39 AM, Rob Audenaerde
<rob.audenaerde@gmail.com> wrote:
> Hi all,
>
> I'm currently looking at the performance of our application, and I see a lot
> of time being spent in  HitQueue.getSentinelObject()   (I track this using
> the VisualVM sampler)
>
> When I look at the implementation, I see a new ScoreDoc is constructed each
> time. Is this necessary? Maybe a static will improve the performance a bit?
>
>
> @Override
>   protected ScoreDoc getSentinelObject() {
>     // Always set the doc Id to MAX_VALUE so that it won't be favored by
>     // lessThan. This generally should not happen since if score is not
> NEG_INF,
>     // TopScoreDocCollector will always add the object to the queue.
>     return new ScoreDoc(Integer.MAX_VALUE, Float.NEGATIVE_INFINITY);
>   }
>
> Thanks in advance,
> - Rob

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


Mime
View raw message