RFR: 8315999: Improve Date toString performance [v13]

Chen Liang liach at openjdk.org
Sun Sep 24 13:06:20 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, it first isn't effectively constant since its composite printerparser isn't immutable/stable. Also we can probably try if we can pre-allocate like for string concat to see if eliminated allocations help. For StringBuilder allocation, if JIT cannot eliminate it, we can probably switch to writing byte array + index since the interface in Formatter seems to be internal.

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

PR Comment: https://git.openjdk.org/jdk/pull/15658#issuecomment-1732565954


More information about the core-libs-dev mailing list