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

温绍锦 duke at openjdk.org
Sun Jun 25 17:22:09 UTC 2023


On Sun, 25 Jun 2023 12:20:17 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:
> 
>   add jdk.util.HexDigits, sharing cache array across multiple classes, including :
>   java.lang.Long#fastUUID
>   java.util.HexDigits
>   java.lang.Long#toHexString(future)
>   java.lang.Integer#toHexString(future)
>   java.util.HexFormat(future)

Should we consider that when COMPACT_STRINGS is false, should it only be guaranteed to work correctly, not the best performance. If based on this principle, the implementation code will be much simpler.

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

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


More information about the core-libs-dev mailing list