Hi Mike, I was curious too, so with the help of your hint I did some more digging. You were correct, as I found two occurences using this construction:
final TopDocs topDocs = indexSearcher.search(pageQuery, Integer.MAX_VALUE); As there are 4.5M documents in this specific index, this caused many calls. Thanks! -Rob On Fri, Jan 20, 2017 at 5:23 PM, Michael McCandless < luc...@mikemccandless.com> wrote: > 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.audenae...@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 >