[jira] [Commented] (LUCENE-5959) Optimized memory management in Automaton.Builder.finish()

2014-09-18 Thread Markus Heiden (JIRA)

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

Markus Heiden commented on LUCENE-5959:
---

I reworked the Builder completely, see Automaton.diff. Now in finish() no 
unneeded memory will be allocated. This looks for me like a clean and (memory) 
efficient solution.

 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: Automaton.diff, 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



[jira] [Commented] (LUCENE-5959) Optimized memory management in Automaton.Builder.finish()

2014-09-18 Thread Michael McCandless (JIRA)

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

Michael McCandless commented on LUCENE-5959:


I like this, I'll commit shortly.  Thanks Markus!

 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, performance
 Attachments: Automaton.diff, 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



[jira] [Commented] (LUCENE-5959) Optimized memory management in Automaton.Builder.finish()

2014-09-18 Thread ASF subversion and git services (JIRA)

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

ASF subversion and git services commented on LUCENE-5959:
-

Commit 1626002 from [~mikemccand] in branch 'dev/branches/branch_5x'
[ https://svn.apache.org/r1626002 ]

LUCENE-5959: add CHANGES entry

 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, performance
 Fix For: 5.0, 6.0

 Attachments: Automaton.diff, 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



[jira] [Commented] (LUCENE-5959) Optimized memory management in Automaton.Builder.finish()

2014-09-18 Thread ASF subversion and git services (JIRA)

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

ASF subversion and git services commented on LUCENE-5959:
-

Commit 1626001 from [~mikemccand] in branch 'dev/trunk'
[ https://svn.apache.org/r1626001 ]

LUCENE-5959: add CHANGES entry

 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, performance
 Fix For: 5.0, 6.0

 Attachments: Automaton.diff, 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



[jira] [Commented] (LUCENE-5959) Optimized memory management in Automaton.Builder.finish()

2014-09-17 Thread Michael McCandless (JIRA)

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

Michael McCandless commented on LUCENE-5959:


Thanks, this is a nice fix!  Maybe instead of using ArrayUtil.grow in that new 
private method, we could just alloc to that exact size?  (Since the Builder 
knows it will only add exactly that many transitions...).

 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
 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



[jira] [Commented] (LUCENE-5959) Optimized memory management in Automaton.Builder.finish()

2014-09-17 Thread Markus Heiden (JIRA)

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

Markus Heiden commented on LUCENE-5959:
---

A better approach would be to create the Automaton with the correct size in 
Builder.finish() instead of creating it in the constructor with a default size. 
But I don't know if there may be changes to Builder.a prior to calling 
Build.finish(), so I choose that safe approach in the patch.

 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



[jira] [Commented] (LUCENE-5959) Optimized memory management in Automaton.Builder.finish()

2014-09-17 Thread Markus Heiden (JIRA)

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

Markus Heiden commented on LUCENE-5959:
---

To avoid the initial creation of the transitions array, I could set it to new 
int[0] by using a static constant for that. I don't know, if that affects the 
performance of other use cases?

 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



[jira] [Commented] (LUCENE-5959) Optimized memory management in Automaton.Builder.finish()

2014-09-17 Thread Michael McCandless (JIRA)

[ 
https://issues.apache.org/jira/browse/LUCENE-5959?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=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