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

Michael McCandless commented on LUCENE-5959:
--------------------------------------------

bq. I may directly allocate  a.transitions = new int[numTransitions * 3]; in 
Builder.finish(), but this looks a bit dirty to me. 

I think that solution is OK?

It's nice not to tie up extra RAM (from ArrayUtil.oversize) since we don't know 
how long the automaton will be around...

> Optimized memory management in Automaton.Builder.finish()
> ---------------------------------------------------------
>
>                 Key: LUCENE-5959
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5959
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: core/other
>    Affects Versions: 4.10
>            Reporter: Markus Heiden
>            Priority: Minor
>              Labels: patch
>         Attachments: finish.patch
>
>
> Reworked Automaton.Builder.finish() to not allocate memory stepwise. Added 
> growTransitions(int numTransitions) to be able to resize the transistions 
> array just once.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to