RFR: 8337279: Optimize format instant

Stephen Colebourne scolebourne at openjdk.org
Fri Jul 26 15:27:35 UTC 2024


On Fri, 26 Jul 2024 14:20:07 GMT, Shaojin Wen <duke at openjdk.org> wrote:

> By removing the redundant code logic in DateTimeFormatterBuilder$InstantPrinterParser#formatTo, the codeSize can be reduced and the performance can be improved.

src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java line 3818:

> 3816:             }
> 3817:             // add fraction
> 3818:             if (fractionalDigits > 0) {

This breaks the logic. `fractionalDigits` can be negative in the block below

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20353#discussion_r1693253379


More information about the core-libs-dev mailing list