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

Michael McCandless commented on LUCENE-2217:
--------------------------------------------

bq.  I'll also try and add a test case that fails when an allocation larger 
than the current initial size is needed

That would be much appreciated ;)  (I hit that too!).

bq. The underlying problem is that ArrayUtils.getNextSize() does not have an 
argument for a minimum increase.  Would it make sense to add that, too?

Well... the arg to getNextSize is already the minimum size that must be 
returned, so, can't you just pass in lastBytePos + MAX_BYTES_PER_INT?

{quote}
The code there has some strange constants (3, 6 and 9) that could
perhaps be dropped when an extra argument for a minimum increase is added.
Looking at the comment there for the growth pattern, shouldn't the second 
number (after 0) be 3 instead of 4?
{quote}
We're working on cleaning up this method, under LUCENE-2213.  The growth 
pattern in the comment is in fact correct, if you were to call getNextSize on 
1+ the current size, ie this progression:

{code}
getNextSize(1+getNextSize(1+getNextSize(1+....getNextSize(1+0)))))
{code}


> SortedVIntList allocation should use ArrayUtils.getNextSize()
> -------------------------------------------------------------
>
>                 Key: LUCENE-2217
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2217
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Other
>            Reporter: Paul Elschot
>            Assignee: Michael McCandless
>            Priority: Trivial
>         Attachments: LUCENE-2217.patch
>
>
> See recent discussion on ArrayUtils.getNextSize().

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to