RFR: JDK-8310502 : Optimization for j.l.Long.fastUUID() [v14]

Glavo duke at openjdk.org
Thu Jun 22 14:36:14 UTC 2023


On Thu, 22 Jun 2023 11:07:09 GMT, 温绍锦 <duke at openjdk.org> wrote:

>> By optimizing the implementation of java.lang.Long#fastUUID, the performance of the java.util.UUID#toString method can be significantly improved.
>> 
>> The following are the test results of JMH: 
>> 
>> Benchmark                     Mode  Cnt      Score      Error   Units
>> UUIDUtilsBenchmark.new       thrpt    5  92676.550 ±  292.213  ops/ms
>> UUIDUtilsBenchmark.original  thrpt    5  37040.165 ± 1023.532  ops/ms
>
> 温绍锦 has updated the pull request incrementally with one additional commit since the last revision:
> 
>   use ByteArray.setInt & setLong

Latest benchmark results:

Apple M1 (+190.26%):

  Benchmark   Mode  Cnt       Score      Error   Units
- UUID.test  thrpt    5   46247.050 ± 1088.442  ops/ms
+ UUID.test  thrpt    5  134235.336 ± 2759.236  ops/ms


Rockchip RK3588 (+103.49%):

  Benchmark   Mode  Cnt      Score    Error   Units
- UUID.test  thrpt    5  22024.693 ± 83.439  ops/ms
+ UUID.test  thrpt    5  44817.679 ± 148.068  ops/ms


AMD Ryzen 7 5800X (+17.58%):

  Benchmark   Mode  Cnt      Score      Error   Units
- UUID.test  thrpt    5  84113.600 ± 1831.692  ops/ms
+ UUID.test  thrpt    5  98897.952 ± 249.251  ops/ms


Intel Celeron N5105 (+31.18%):

  Benchmark   Mode  Cnt      Score     Error   Units
- UUID.test  thrpt    5  27068.861 ± 498.483  ops/ms
+ UUID.test  thrpt    5  35507.873 ± 343.376  ops/ms


Looks good, using `ByteArray` does bring a noticeable performance boost.

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

PR Comment: https://git.openjdk.org/jdk/pull/14578#issuecomment-1602750203


More information about the core-libs-dev mailing list