RFR: 8275821: Optimize random number generators developed in JDK-8248862 using Math.unsignedMultiplyHigh() [v5]

Vamsi Parasa duke at openjdk.java.net
Fri Dec 3 02:15:00 UTC 2021


On Fri, 3 Dec 2021 00:27:13 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:

>> Vamsi Parasa has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update the JMH micro to take RNG parameters for elegant implementation
>
> test/micro/org/openjdk/bench/java/util/RandomGeneratorNext.java line 47:
> 
>> 45: public class RandomGeneratorNext {
>> 46: 
>> 47:     public RandomGenerator randomGenerator;
> 
> Suggestion:
> 
>     RandomGenerator randomGenerator;

Incorporated your suggestion in the recent commit...

> test/micro/org/openjdk/bench/java/util/RandomGeneratorNext.java line 52:
> 
>> 50:     String randomGeneratorName;
>> 51: 
>> 52:     public static long[] buffer;
> 
> Suggestion:
> 
>     long[] buffer;

Incorporated your suggestion in the recent commit...

> test/micro/org/openjdk/bench/java/util/RandomGeneratorNext.java line 69:
> 
>> 67: 
>> 68:     @Benchmark
>> 69:     @Fork(1)
> 
> Why is `@Fork` need here?

Removed the @Fork annotation...

> test/micro/org/openjdk/bench/java/util/RandomGeneratorNext.java line 70:
> 
>> 68:     @Benchmark
>> 69:     @Fork(1)
>> 70:     public void testFillBufferWithNextLong() {
> 
> Return `buffer` after the loop completes, just in case the JIT decides it is otherwise dead code

Added the code to return buffer at the end of the loop...

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

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


More information about the core-libs-dev mailing list