RFR: 8337168: Optimize LocalDateTime.toString

Chen Liang liach at openjdk.org
Thu Jul 25 15:35:30 UTC 2024


On Thu, 25 Jul 2024 06:19:46 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.
>
> Below are the performance numbers running on a MacBook M1 Max, which increased speed by +179.88%
> 
> 
> -# master 05d88de05e9b7814ecd5517aacd17f0feafdff3c
> -Benchmark                             Mode  Cnt  Score   Error   Units
> -ToStringBench.localDateTimeToString  thrpt   15  4.896 ? 1.414  ops/ms
> 
> +# current c03ed26ffdf2cebcc9074c2aeae27fbb1f49c025
> +Benchmark                             Mode  Cnt   Score   Error   Units
> +ToStringBench.localDateTimeToString  thrpt   15  13.703 ? 1.960  ops/ms +179.88%

@wenshao Please give other reviewers (especially those maintaining the locale area) some time to take a look: https://openjdk.org/guide/#life-of-a-pr recommends to wait for 24 hours for reviewers before integrating a pull request.

Also, ran tier 1-3 tests for this patch and looks good.

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

PR Comment: https://git.openjdk.org/jdk/pull/20321#issuecomment-2250698964


More information about the core-libs-dev mailing list