RFR: 8337168: Optimize LocalDateTime.toString [v3]
Chen Liang
liach at openjdk.org
Thu Jul 25 22:54:37 UTC 2024
On Thu, 25 Jul 2024 22:51:09 GMT, Shaojin Wen <duke at openjdk.org> wrote:
>> The current LocalDateTime.toString implementation concatenates the toString results of date and time, which can be passed to StringBuilder to reduce additional object allocation and improve performance.
>
> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
>
> change description
src/java.base/share/classes/java/time/LocalTime.java line 1641:
> 1639: /**
> 1640: * Prints the toString result to the given buf, avoiding extra string allocations.
> 1641: * Requires extra capacity of 10 to avoid StringBuilder reallocation.
Suggestion:
* Requires extra capacity of 18 to avoid StringBuilder reallocation.
Sorry I left a typo, you see toString is `new StringBuilder(18)`
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20321#discussion_r1692240103
More information about the core-libs-dev
mailing list