RFR: 8315999: Improve Date toString performance [v2]

温绍锦 duke at openjdk.org
Mon Sep 11 14:57:42 UTC 2023


On Mon, 11 Sep 2023 13:29:14 GMT, Claes Redestad <redestad at openjdk.org> wrote:

>> 温绍锦 has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   fix LocalDate.getChars offset
>
> src/java.base/share/classes/java/time/Instant.java line 1355:
> 
>> 1353:     @Override
>> 1354:     public String toString() {
>> 1355:         return DateTimeFormatter.ISO_INSTANT.format(this);
> 
> Have you considered potentially more generalizable optimizations to `DateTimeFormatter.ISO_INSTANT.format(this)` here? 
> 
> Hand-rolling a fixed-length buffer, skipping the `StringBuilder` .. understandably this can have a performance edge, but perhaps a `DateTimeFormatter` like `ISO_INSTANT` can be optimized to get closer to whatever speed-up this gets you - with broader implications.

The performance of optimizing DateTimeFormatter cannot be as fast as using ixed-length buffer directly.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15658#discussion_r1321680823



More information about the security-dev mailing list