Standardize dynamic array growth factor

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: None
    • Component/s: core-libs

      ByteArrayOutputStream (along with some other classes) uses an exponential growth factor of 2 for its internal buffer, i.e. it doubles in size when it exceeds its existing capacity.

      Other JDK classes use a factor of 1.5, e.g. ArrayList, StringLatin1 or 2 separate values depending on the absolute size (PriorityBlockingQueue).

      Should we standardize on one value?

      I haven't found any discussion or reasoning on the two different values specifically in JDK, though there's plenty of discussion externally (e.g. https://en.wikipedia.org/wiki/Dynamic_array#Growth_factor).

            Assignee:
            Brian Burkhalter
            Reporter:
            Oli Gillespie
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: