<i18n dev> RFR: 8283996: Reduce cost of year and month calculations

Roger Riggs rriggs at openjdk.java.net
Wed Mar 30 22:19:33 UTC 2022


On Wed, 30 Mar 2022 12:06:39 GMT, Claes Redestad <redestad at openjdk.org> wrote:

> A few integer divisions and multiplications can be replaced with test + addition, leading to a decent speed-up on java.time microbenchmarks such as `GetYearBench`. Numbers from my local x86 workstation, seeing similar speed-up on aarch64 and other x86 setups.
> 
> Baseline:
> 
> Benchmark                                            Mode  Cnt   Score   Error   Units
> GetYearBench.getYearFromMillisZoneOffset            thrpt   15  18.492 ± 0.017  ops/ms
> GetYearBench.getYearFromMillisZoneRegion            thrpt   15   6.121 ± 0.135  ops/ms
> GetYearBench.getYearFromMillisZoneRegionNormalized  thrpt   15  18.936 ± 0.012  ops/ms
> GetYearBench.getYearFromMillisZoneRegionUTC         thrpt   15   9.283 ± 0.222  ops/ms
> 
> Patched:
> 
> Benchmark                                            Mode  Cnt   Score   Error   Units
> GetYearBench.getYearFromMillisZoneOffset            thrpt   15  20.931 ± 0.013  ops/ms
> GetYearBench.getYearFromMillisZoneRegion            thrpt   15   6.858 ± 0.167  ops/ms
> GetYearBench.getYearFromMillisZoneRegionNormalized  thrpt   15  20.923 ± 0.017  ops/ms
> GetYearBench.getYearFromMillisZoneRegionUTC         thrpt   15  10.028 ± 0.182  ops/ms
> 
> 
> Testing: java.time tests locally, CI tier1+2 ongoing.

Marked as reviewed by rriggs (Reviewer).

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

PR: https://git.openjdk.java.net/jdk/pull/8039


More information about the i18n-dev mailing list