[ 
https://issues.apache.org/jira/browse/LUCENE-1593?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12703329#action_12703329
 ] 

Michael McCandless commented on LUCENE-1593:
--------------------------------------------

bq. I thought we agreed that initializing to Float.NEG_INF is reasonable for 
TSDC? 

Woops, sorry, you're right.  I'm just losing my mind.

I think the javadoc for PriorityQueue.addSentinelObjects should state
that the Objects must all be logically "equal"?  Ie we do a straight
copy into the pqueue, so if they are not equal then the pqueue is in a
messed up state.

Actually that method is somewhat awkward.  I wonder if, instead, we
could define an Object getSentinelObject(), returning null by default,
and the pqueue on creation would call that and if it's non-null, fill
the queue (by calling it maxSize times)?

bq. Could be useful - but then we should probably do it on DocIdSetIterator 
with default impl, and override where it makes sense (BS and BS2)? Also, if we 
do this, why not adding an end() too, allowing a DISI to release resources?

Actually.... shouldn't Weight.scorer(...) in general be the place
where such "pre-next() initializatoin" is done?  EG
BooleanWeight.scorer(...) should call BS2's initCountingSumScorer
(and/or somehow forward to BS)?

bq. Yes I kept BS and BS2 in mind ... if we condiionalize anything, it means 
extra 'if'. If we want to avoid that 'if', we need to create a variant of the 
class, which might not be so bad in TSDC, but will look awful in TFC 
(additional 6 classes).

Yeah that's (the * 2 splintering) is what I was fearing.  At some
point we should leave this splintering to source code
specialization...it's getting somewhat crazy now.

bq. Perhaps we should still attempt to add to PQ if cmp == 0?

That basically undoes the "don't fallback to docID" optimization
right?

bq. Or did you have something else in mind?

The 6 new classes is what I feared we'd need to do.  Else, with the
changes here (that never break ties by docID), TopFieldCollector can't
be used with BooleanScorer (which breaks back compat).

I guess since the 6 classes are hidden under the
TopFieldCollector.create it's maybe not so bad?


> Optimizations to TopScoreDocCollector and TopFieldCollector
> -----------------------------------------------------------
>
>                 Key: LUCENE-1593
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1593
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Search
>            Reporter: Shai Erera
>             Fix For: 2.9
>
>         Attachments: LUCENE-1593.patch, PerfTest.java
>
>
> This is a spin-off of LUCENE-1575 and proposes to optimize TSDC and TFC code 
> to remove unnecessary checks. The plan is:
> # Ensure that IndexSearcher returns segements in increasing doc Id order, 
> instead of numDocs().
> # Change TSDC and TFC's code to not use the doc id as a tie breaker. New docs 
> will always have larger ids and therefore cannot compete.
> # Pre-populate HitQueue with sentinel values in TSDC (score = Float.NEG_INF) 
> and remove the check if reusableSD == null.
> # Also move to use "changing top" and then call adjustTop(), in case we 
> update the queue.
> # some methods in Sort explicitly add SortField.FIELD_DOC as a "tie breaker" 
> for the last SortField. But, doing so should not be necessary (since we 
> already break ties by docID), and is in fact less efficient (once the above 
> optimization is in).
> # Investigate PQ - can we deprecate insert() and have only 
> insertWithOverflow()? Add a addDummyObjects method which will populate the 
> queue without "arranging" it, just store the objects in the array (this can 
> be used to pre-populate sentinel values)?
> I will post a patch as well as some perf measurements as soon as I have them.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to