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

温绍锦 duke at openjdk.org
Sun Jun 25 16:56:08 UTC 2023


On Sun, 25 Jun 2023 16:48:06 GMT, 温绍锦 <duke at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/Long.java line 451:
>> 
>>> 449:     }
>>> 450: 
>>> 451:     static String fastUUID(long lsb, long msb) {
>> 
>> This method should probably have an assert or something that `COMPACT_STRINGS` is `true`, e.g.:
>> Suggestion:
>> 
>>     static String fastUUID(long lsb, long msb) {
>>         if (!COMPACT_STRINGS) {
>>             throw new InternalError("Long::fastUUID requires compact strings");
>>         }
>
> it's none-public method, only for UUID.toString

now the fastUUID method codeSize is 325, which is equal to the maximum value of FreqInlineSize under aarch64 and x64. if additional assertion is added, the method codeSize > 325, cannot be inlined, resulting in performance degradation.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14578#discussion_r1241237407


More information about the core-libs-dev mailing list