RFR: 8311207: Cleanup for Optimization for UUID.toString [v9]
Chen Liang
liach at openjdk.org
Tue Sep 5 03:47:55 UTC 2023
On Tue, 5 Sep 2023 02:46:21 GMT, 温绍锦 <duke at openjdk.org> wrote:
>> [PR 14578 ](https://github.com/openjdk/jdk/pull/14578) still has unresolved discussions, continue to make improvements.
>>
>> # Benchmark Result
>>
>>
>> sh make/devkit/createJMHBundle.sh
>> bash configure --with-jmh=build/jmh/jars
>> make test TEST="micro:java.util.UUIDBench.toString"
>>
>>
>> ## 1. [aliyun_ecs_c8i.xlarge](https://help.aliyun.com/document_detail/25378.html#c8i)
>> * cpu : intel xeon sapphire rapids (x64)
>>
>> ``` diff
>> -Benchmark (size) Mode Cnt Score Error Units (baseline)
>> -UUIDBench.toString 20000 thrpt 15 62.019 ± 0.622 ops/us
>>
>> +Benchmark (size) Mode Cnt Score Error Units
>> +UUIDBench.toString 20000 thrpt 15 82.998 ± 0.739 ops/us (+33.82%)
>>
>>
>> ## 2. [aliyun_ecs_c8a.xlarge](https://help.aliyun.com/document_detail/25378.html#c8a)
>> * cpu : amd epc genoa (x64)
>>
>> ``` diff
>> -Benchmark (size) Mode Cnt Score Error Units (baseline)
>> -UUIDBench.toString 20000 thrpt 15 88.668 ± 0.672 ops/us
>>
>> +Benchmark (size) Mode Cnt Score Error Units
>> +UUIDBench.toString 20000 thrpt 15 89.229 ± 0.271 ops/us (+0.63%)
>>
>>
>>
>> ## 3. [aliyun_ecs_c8y.xlarge](https://help.aliyun.com/document_detail/25378.html#c8y)
>> * cpu : aliyun yitian 710 (aarch64)
>> ``` diff
>> -Benchmark (size) Mode Cnt Score Error Units (baseline)
>> -UUIDBench.toString 20000 thrpt 15 49.382 ± 2.160 ops/us
>>
>> +Benchmark (size) Mode Cnt Score Error Units
>> +UUIDBench.toString 20000 thrpt 15 49.636 ± 1.974 ops/us (+0.51%)
>>
>>
>> ## 4. MacBookPro M1 Pro
>> ``` diff
>> -Benchmark (size) Mode Cnt Score Error Units (baseline)
>> -UUIDBench.toString 20000 thrpt 15 103.543 ± 0.963 ops/us
>>
>> +Benchmark (size) Mode Cnt Score Error Units
>> +UUIDBench.toString 20000 thrpt 15 110.976 ± 0.685 ops/us (+7.17%)
>>
>>
>> ## 5. Orange Pi 5 Plus
>>
>> ``` diff
>> -Benchmark (size) Mode Cnt Score Error Units (baseline)
>> -UUIDBench.toString 20000 thrpt 15 33.532 ± 0.396 ops/us
>>
>> +Benchmark (size) Mode Cnt Score Error Units (PR)
>> +UUIDBench.toString 20000 thrpt 15 33.054 ± 0.190 ops/us (-4.42%)
>
> 温绍锦 has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 11 additional commits since the last revision:
>
> - Merge branch 'master' into optimization_for_uuid_to_string
> - use ByteArrayLittleEndian
> - fix typo
> - code style
> - Explain the rationale
>
> Co-authored-by: liach <liach at users.noreply.github.com>
> - private static final Unsafe
> - revert to the previous version
> - Merge pull request #1 from liachmodded/optimization_for_uuid_to_string
>
> Suggested HexDigits change
> - Suggested HexDigits change
> - use big endian
> - ... and 1 more: https://git.openjdk.org/jdk/compare/ac7b7229...69962433
src/java.base/share/classes/java/util/HexDigits.java line 68:
> 66:
> 67: /**
> 68: * Return a big-endian packed integer for the 4 ASCII bytes for an input unsigned 2-byte integer.
Suggestion:
* Returns a little-endian packed integer for the 4 ASCII bytes for an input unsigned 2-byte integer.
src/java.base/share/classes/java/util/HexDigits.java line 77:
> 75:
> 76: /**
> 77: * Return a big-endian packed long for the 8 ASCII bytes for an input unsigned 4-byte integer.
Suggestion:
* Returns a little-endian packed long for the 8 ASCII bytes for an input unsigned 4-byte integer.
src/java.base/share/classes/java/util/UUID.java line 494:
> 492: buf,
> 493: 24,
> 494: HexDigits.packDigits(((int) (lsb >> 40)), (int) (lsb >> 32), ((int) lsb) >> 24, ((int) lsb) >> 16));
Suggestion:
HexDigits.packDigits((int) (lsb >> 40), (int) (lsb >> 32), ((int) lsb) >> 24, ((int) lsb) >> 16));
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14745#discussion_r1315331223
PR Review Comment: https://git.openjdk.org/jdk/pull/14745#discussion_r1315331130
PR Review Comment: https://git.openjdk.org/jdk/pull/14745#discussion_r1315314460
More information about the core-libs-dev
mailing list