RFR: 8337279: Optimize format instant [v7]

Naoto Sato naoto at openjdk.org
Tue Sep 3 17:35:24 UTC 2024


On Tue, 27 Aug 2024 23:49:50 GMT, Shaojin Wen <swen 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 with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains nine additional commits since the last revision:
> 
>  - Speed up Instant.toString using JavaTimeAccess
>  - add JavaTimeAccess SharedSecrets
>  - Merge remote-tracking branch 'upstream/master' into optim_instant_fmt_202407
>  - breaking out the printNano methods
>  - copyright
>  - Update src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java
>    
>    Co-authored-by: Stephen Colebourne <scolebourne at joda.org>
>  - 1. fix handle fraction == -1
>    2. Split two methods to make codeSize less than 325
>  - add comment
>  - optimize format instant

I don't think using SharedSecret just for performance improvement and code size reduction is the right way, as the class is the last resort as the header says:

 * <p><strong>
 * Usage of these APIs often means bad encapsulation designs,
 * increased complexity and lack of sustainability.
 * Use this only as a last resort!
 * </strong>

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

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


More information about the core-libs-dev mailing list