<i18n dev> RFR: 8337279: Share StringBuilder to format instant [v15]
Chen Liang
liach at openjdk.org
Sat Mar 22 00:38:09 UTC 2025
On Mon, 3 Feb 2025 22:31:10 GMT, Shaojin Wen <swen at openjdk.org> wrote:
>> 1. Create a tool class jdk.internal.util.DateTimeHelper, move the formatTo method of LocalDateTime/LocalDate/LocalTime to it, so that these methods can be used across packages within JDK, so that StringBuilder can be shared, avoiding multiple creation of StringBuilder and toString.
>> 2. Refactor DateTimeFormatterBuilder::format to use the jdk.internal.util.DateTimeHelper::formatTo method.
>> 3. Split the DateTimeFormatterBuilder::format method, separate the currentEra and beforeCurrentEra sub-methods, so that codeSize < 325 can be inlined. Most scenarios call currentEra, so performance is improved.
>
> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
>
> from @natoj
Refactor looks harmless. Optimization is splitting methods to help profiling and avoid one string copy in ZonedDateTime.
-------------
Marked as reviewed by liach (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/20353#pullrequestreview-2707617525
More information about the i18n-dev
mailing list