RFR: JDK-8310502 : Optimization for j.l.Long.fastUUID() [v26]
Chen Liang
liach at openjdk.org
Tue Jun 27 13:00:18 UTC 2023
On Tue, 27 Jun 2023 11:27:18 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:
>
> fix UUID.java import, rename jdk.util.HexDigits to jdk.util.Hex256 and make private constructor.
src/java.base/share/classes/java/util/UUID.java line 479:
> 477: ((long) hex256[((int) (msb >> 56)) & 0xff] << 48)
> 478: | ((long) hex256[((int) (msb >> 48)) & 0xff] << 32)
> 479: | ((long) hex256[((int) (msb >> 40)) & 0xff] << 16)
The long cast seems redundant here.
src/java.base/share/classes/jdk/internal/util/Hex256.java line 34:
> 32: */
> 33: public final class Hex256 {
> 34: private Hex256(){
Suggestion:
private Hex256() {
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14578#discussion_r1243683233
PR Review Comment: https://git.openjdk.org/jdk/pull/14578#discussion_r1243688988
More information about the core-libs-dev
mailing list