[
https://issues.apache.org/jira/browse/LUCENE-6365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14491672#comment-14491672
]
Dawid Weiss commented on LUCENE-6365:
-------------------------------------
{code}
for (IntsRef finiteString; (finiteString = iterator.next()) != null;)
{code}
Many people have strong feelings about assignments in conditional expressions.
In fact I just recently stumbled upon an Eclipse JDT refactoring bug that was
evaluating these (and refactoring these) incorrectly. My comment was actually
meant to go together with the "why don't we make it an iterator" one... If you
did that then the problem of what kind of loop it is pretty much disappears.
Anyway, this is really minor and a matter of style rather than correctness. It
can go in as-is.
bq. I marked Operations.getFiniteStrings() as deprecated in my patch [...] What
do you think?
No strong opinion. If it's only used from tests then you can mark it as
deprecated I guess; no need to support redundant code.
bq. May I raise it from 4 to e.g. 16?
It very likely won't matter in practice at all. I think increasing it to 16
won't do anybody any harm (you could try to squeeze it into a single line
cache, but I think it's an overkill and premature optimization; it'll vanish in
other processing noise).
> Optimized iteration of finite strings
> -------------------------------------
>
> Key: LUCENE-6365
> URL: https://issues.apache.org/jira/browse/LUCENE-6365
> Project: Lucene - Core
> Issue Type: Improvement
> Components: core/other
> Affects Versions: 5.0
> Reporter: Markus Heiden
> Priority: Minor
> Labels: patch, performance
> Attachments: FiniteStringsIterator.patch
>
>
> Replaced Operations.getFiniteStrings() by an optimized FiniteStringIterator.
> Benefits:
> Avoid huge hash set of finite strings.
> Avoid massive object/array creation during processing.
> "Downside":
> Iteration order changed, so when iterating with a limit, the result may
> differ slightly. Old: emit current node, if accept / recurse. New: recurse /
> emit current node, if accept.
> The old method Operations.getFiniteStrings() still exists, because it eases
> the tests. It is now implemented by use of the new FiniteStringIterator.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]