[ https://issues.apache.org/jira/browse/LUCENE-2213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12800828#action_12800828 ]
Marvin Humphrey commented on LUCENE-2213: ----------------------------------------- Algorithm looks good. The addition of the mandatory second argument works well. Nice work. Looks like there's a typo in the currently unused constant "NUM_BYTES_DOUBLT". As for the tests... Testing that optimizations like these are working properly is a pain, so I understand why you zapped 'em. Sometimes inequality or proportional testing can work in these situations: {code} assertTrue(t.termBuffer().length > t.termLength()); {code} That assertion wouldn't always hold true for this object, because sometimes the term will fill the whole array. And in a perfect world, you'd want to test that each and every array growth happens as expected -- but that's not practical. Still, in my opinion, a fragile, imperfect test in this situation is OK. > Small improvements to ArrayUtil.getNextSize > ------------------------------------------- > > Key: LUCENE-2213 > URL: https://issues.apache.org/jira/browse/LUCENE-2213 > Project: Lucene - Java > Issue Type: Improvement > Reporter: Michael McCandless > Assignee: Michael McCandless > Priority: Minor > Fix For: 3.1 > > Attachments: LUCENE-2213.patch > > > Spinoff from java-dev thread "Dynamic array reallocation algorithms" started > on Jan 12, 2010. > Here's what I did: > * Keep the +3 for small sizes > * Added 2nd arg = number of bytes per element. > * Round up to 4 or 8 byte boundary (if it's 32 or 64 bit JRE respectively) > * Still grow by 1/8th > * If 0 is passed in, return 0 back > I also had to remove some asserts in tests that were checking the actual > values returned by this method -- I don't think we should test that (it's an > impl. detail). -- 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