RFR: 8315999: Improve Date toString performance [v2]

温绍锦 duke at openjdk.org
Mon Sep 11 16:00:42 UTC 2023


On Mon, 11 Sep 2023 14:44:24 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:
> 
>   fix LocalDate.getChars offset

# benchmark script

## 1. Script

bash configure
make images
sh make/devkit/createJMHBundle.sh
bash configure --with-jmh=build/jmh/jars
make test TEST="micro:java.time.ToStringBench.*


## 2. MacBookPro M1 Pro Benchmark 


``` diff
-Benchmark                                 Mode  Cnt    Score    Error   Units (baseline)
-ToStringBench.testInstantToString        thrpt   15    3.900 ?  0.289  ops/ms
-ToStringBench.testLocalDateTimeToString  thrpt   15   11.081 ?  0.141  ops/ms
-ToStringBench.testLocalDateToString      thrpt   15   18.566 ?  1.852  ops/ms
-ToStringBench.testLocalTimeToString      thrpt   15    8.428 ?  1.066  ops/ms
-ToStringBench.testZoneOffsetOffHours     thrpt   15  115.342 ? 13.978  ops/ms
-ToStringBench.testZonedDateTimeToString  thrpt   15    4.669 ?  1.986  ops/ms

+Benchmark                                 Mode  Cnt    Score   Error   Units (PR cc82e8c1)
+ToStringBench.testInstantToString        thrpt   15   47.971 ? 0.131  ops/ms (+1130.02%)
+ToStringBench.testLocalDateTimeToString  thrpt   15   71.310 ? 0.633  ops/ms (+543.53%)
+ToStringBench.testLocalDateToString      thrpt   15  108.236 ? 1.613  ops/ms (+482.97%)
+ToStringBench.testLocalTimeToString      thrpt   15  128.264 ? 1.052  ops/ms (+1421.87%)
+ToStringBench.testZoneOffsetOffHours     thrpt   15  694.463 ? 2.671  ops/ms (+502.29%)
+ToStringBench.testZonedDateTimeToString  thrpt   15   46.975 ? 0.850  ops/ms (+906.10%)

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

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



More information about the security-dev mailing list