Adrien Grand created LUCENE-6009:
------------------------------------
Summary: 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
Fix For: 5.0
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]