RFR: 8337279: Optimize format instant [v4]

Stephen Colebourne scolebourne at openjdk.org
Sun Aug 11 10:17:08 UTC 2024


On Sun, 11 Aug 2024 10:13:12 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.
>
> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java
>   
>   Co-authored-by: Stephen Colebourne <scolebourne at joda.org>

A more productive direction might be to move `LocalDate.formatTo` and `LocalTime.formatTo` to a JDK internal class (eg. in `jdk.internal.util`?), and then edit `LocalTime.formatTo` to handle `fractionalDigits` directly as another method parameter. This would allow the formatters in `DateTimeFormatterBuilder` to directly use the `formatTo` methods without adding any new public APIs.

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

PR Comment: https://git.openjdk.org/jdk/pull/20353#issuecomment-2282706467


More information about the core-libs-dev mailing list