<i18n dev> Integrated: 8337279: Share StringBuilder to format instant
Shaojin Wen
swen at openjdk.org
Sat Mar 22 01:38:33 UTC 2025
On Fri, 26 Jul 2024 14:20:07 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.
This pull request has now been integrated.
Changeset: 74420391
Author: Shaojin Wen <swen at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/74420391faff5614d3c9254be1fd2e764c3f0731
Stats: 449 lines in 10 files changed: 326 ins; 107 del; 16 mod
8337279: Share StringBuilder to format instant
Reviewed-by: naoto, liach
-------------
PR: https://git.openjdk.org/jdk/pull/20353
More information about the i18n-dev
mailing list