RFR: 8315999: Improve Date toString performance [v13]
温绍锦
duke at openjdk.org
Sun Sep 24 13:51:23 UTC 2023
On Wed, 13 Sep 2023 14:22:35 GMT, 温绍锦 <duke at openjdk.org> wrote:
>> improve date toString performance, includes:
>>
>> java.util.Date.toString
>> java.util.Date.toGMTString
>> java.time.Instant.toString
>> java.time.LocalDate.toString
>> java.time.LocalDateTime.toString
>> java.time.LocalTime.toString
>
> 温绍锦 has updated the pull request incrementally with one additional commit since the last revision:
>
> simplify LocalDate::getChars
For DateTimeFormatter's parse and format, an effective way to improve performance is to perform fast-path optimization on commonly used patterns. PR #15658 is the fast-path of DateTimeFormatter#format for commonly used patterns.
I also found a way to find the ZoneOffset faster for ZoneIds without daylight saving time, for example Asia/Shanghai.
The combination of these optimizations can make the performance of DateTime's parse and format very fast.
In the baseline code, only Instant#toString uses DateTimeFormatter. The toString Method of Date/LocalDate/LocalDateTime does not use DateTimeFormatter. The current implementation of DateTimeFormatter is not fast enough. After we improve the performance of DateTimeFormatter, we can implement the toString methods of these classes based on DateTimeFormatter.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/15658#issuecomment-1732574522
More information about the core-libs-dev
mailing list