RFR: JDK-8310502 : Optimization for j.l.Long.fastUUID() [v8]
Roger Riggs
rriggs at openjdk.org
Thu Jun 22 16:35:08 UTC 2023
On Thu, 22 Jun 2023 07:25:34 GMT, 温绍锦 <duke at openjdk.org> wrote:
>> 温绍锦 has updated the pull request incrementally with one additional commit since the last revision:
>>
>> fix compile error
>
>> I've tested the benchmarks and the patch and baseline (with extra stable annotation) with a slightly varied version suitable for gradle run:
>>
>> ```java
>> package com.alibaba.openjdk;
>>
>> import org.openjdk.jmh.annotations.Benchmark;
>> import org.openjdk.jmh.annotations.BenchmarkMode;
>> import org.openjdk.jmh.annotations.Fork;
>> import org.openjdk.jmh.annotations.Measurement;
>> import org.openjdk.jmh.annotations.Mode;
>> import org.openjdk.jmh.annotations.OutputTimeUnit;
>> import org.openjdk.jmh.annotations.Warmup;
>> import org.openjdk.jmh.infra.Blackhole;
>>
>> import java.util.UUID;
>> import java.util.concurrent.TimeUnit;
>>
>> @BenchmarkMode(Mode.Throughput)
>> @OutputTimeUnit(TimeUnit.MILLISECONDS)
>> @Warmup(iterations = 3, time = 10)
>> @Measurement(iterations = 6, time = 5)
>> @Fork(1)
>> public class UUIDUtilsBenchmark {
>> public static UUID uuid = UUID.randomUUID();
>>
>> @Benchmark
>> public void jdk(Blackhole bh) {
>> bh.consume(uuid.toString());
>> }
>>
>> @Benchmark
>> public void fast(Blackhole bh) {
>> bh.consume(UUIDUtils.fastUUID(uuid));
>> }
>> }
>> ```
>>
>> The throughput varies a lot between iterations somehow; the patch and baseline with stable has no significant difference (i.e. within the error range, about 10%)
>
> the performance of this improvement varies among different environments, with a significant improvement on the MacBookPro M1 Max chip (my laptop) and only about 10% improvement on Linux servers (Intel Xeon(Sapphire Rapids) Platinum and Aliyun Yitian 710 arm CPU and Orange Pi 5 Plus).
@wenshao Integration is only possible after Reviewers have approved; so far there it has not been "Approved".
It may be useful to re-read sections on developing a PR of the [OpenJDK developers guide](https://openjdk.org/guide/#life-of-a-pr).
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14578#issuecomment-1602979249
More information about the core-libs-dev
mailing list