RFR: 8186670: Implement _onSpinWait() intrinsic for AArch64 [v13]

Andrew Haley aph at openjdk.java.net
Thu Oct 21 14:40:17 UTC 2021


On Thu, 21 Oct 2021 09:03:15 GMT, Evgeny Astigeevich <duke at openjdk.java.net> wrote:

>> test/micro/org/openjdk/bench/java/lang/ThreadOnSpinWaitProducerConsumer.java line 47:
>> 
>>> 45: @State(Scope.Benchmark)
>>> 46: public class ThreadOnSpinWaitProducerConsumer {
>>> 47:     @Param({"100"})
>> 
>> This test seems rather artificial and unrealistic to me. You can get improved performance simply by increasing the `spinNum` so that it waits for longer. The way to get some advantage from `onSpinWait` is to have multiple threads racing to update the same thing, e.g. to acquire a lock.
>
> @theRealAph, done

Looks good. I'm not entirely sure whether this test is truly representative of the real-world cases that people have seen, but if we find out more we can always add another JMH test.

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

PR: https://git.openjdk.java.net/jdk/pull/5562


More information about the hotspot-dev mailing list