Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-2213

Small improvements to ArrayUtil.getNextSize

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0-ALPHA
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

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

        Attachments

        1. LUCENE-2213-mergetest.patch
          4 kB
          Uwe Schindler
        2. LUCENE-2213.patch
          33 kB
          Michael McCandless
        3. LUCENE-2213.patch
          31 kB
          Michael McCandless
        4. LUCENE-2213.patch
          32 kB
          Michael McCandless
        5. LUCENE-2213.patch
          32 kB
          Michael McCandless

          Activity

            People

            • Assignee:
              mikemccand Michael McCandless
              Reporter:
              mikemccand Michael McCandless
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: