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

Simon Willnauer commented on LUCENE-5628:
-----------------------------------------

I think it's worth doing the optimization here. A couple of comments

 * can we put the exit condition into the while block instead of at the end 
with a break I think it can just be while(string.length > 0) 
 * looking at the impl of State I think we can just use an identity hashset or 
maybe even an array since the Ids are within known bounds to check the 
pathStates? You could even just us a bitset and mark the state ID as visited? 
Hmm now that I wrote it I see your comment :) I will leave it here for 
dicsussion.
 * Somewhat unrelated but I think the State implementation has a problem since 
it doen't override equlas but it should since it has an hashcode impl. I wonder 
if we either should remove the hashCode or add equals just for consistency?
 * should we rather throw IllegalState than IllegalArgument :D 
 * just for readability it might be good to s/strings/finiteStrings/ I had a 
hard time to see when you do things on the string vs. strings
 * is this a leftover ==> // a.getNumberedStates();




> SpecialOperations.getFiniteStrings should not recurse
> -----------------------------------------------------
>
>                 Key: LUCENE-5628
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5628
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>             Fix For: 4.9, 5.0
>
>         Attachments: LUCENE-5628.patch
>
>
> Today it consumes one Java stack frame per transition, which when used by 
> AnalyzingSuggester is per character in each token.  This can lead to stack 
> overflows if you have a long suggestion.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to