[
https://issues.apache.org/jira/browse/LUCENE-6009?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14173778#comment-14173778
]
ASF subversion and git services commented on LUCENE-6009:
---------------------------------------------------------
Commit 1632314 from [~jpountz] in branch 'dev/trunk'
[ https://svn.apache.org/r1632314 ]
LUCENE-6009: Remove redundant == NO_MORE_DOCS checks.
> Remove redundant == NO_MORE_DOCS checks
> ---------------------------------------
>
> Key: LUCENE-6009
> URL: https://issues.apache.org/jira/browse/LUCENE-6009
> Project: Lucene - Core
> Issue Type: Improvement
> Reporter: Adrien Grand
> Assignee: Adrien Grand
> Priority: Minor
> Fix For: 5.0
>
> Attachments: LUCENE-6009.patch
>
>
> When I added some new doc id sets, I took inspiration from FixedBitSet which
> had protection for bad users of its iterator by basically doing
> {code}
> if (doc == NO_MORE_DOCS || ++doc >= numBits) {
> return doc = NO_MORE_DOCS;
> }
> {code}
> in order to not overflow the integer {{doc}} when the iterator was already
> exhausted. However, DocIdSetIterator clearly states that the behaviours of
> nextDoc() and advance() are undefined when the iterator is already exhausted
> so we do not need such protection.
> For the record, I don't expect better performance from this change since the
> branch is highly predictable (benchmarks seem to support this). At best it
> might just help inlining by making methods smaller.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]