RFR: 8364781: Re-examine DigitList digits resizing during parsing

Chen Liang liach at openjdk.org
Fri Aug 8 22:38:12 UTC 2025


On Fri, 8 Aug 2025 20:46:34 GMT, Justin Lu <jlu at openjdk.org> wrote:

> This PR changes the DigitList resizing from adding increments of 100 to a doubling resizing approach. This helps with performance of larger String values during `DecimalFormat` parsing. See the comment on the associated JBS issue for further detail.

src/java.base/share/classes/java/text/DigitList.java line 157:

> 155:         if (count == digits.length) {
> 156:             char[] data = new char[count > Integer.MAX_VALUE / 2 ?
> 157:                     Integer.MAX_VALUE : count * 2];

I think you can use `ArraysSupport.newLength(count, 1, count)` instead.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/26705#discussion_r2264086346


More information about the core-libs-dev mailing list