[foreign-memaccess] RFR 8219852: Create a set of standard benchmarks

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Fri Jan 10 14:07:32 UTC 2020


New revision here

http://cr.openjdk.java.net/~mcimadamore/panama/8219852_part2_v4

Maurizio

On 10/01/2020 11:29, Jorn Vernee wrote:
> Hi,
>
> I'd make one change in both classes:
>
>     static final int ELEM_SIZE = 1_000_000;
>     static final int CARRIER_SIZE = (int)JAVA_INT.byteSize();
>     static final int ALLOC_SIZE = ELEM_SIZE * CARRIER_SIZE;
>
> So that we loop over 1 million ints as well. This maintains the 
> scaling between 1 -> 1_000_000 and nanoseconds -> milliseconds.
>
> You can also still replace the '4' with 'CARRIER_SIZE' in both classes 
> when initializing the unsafe memory.
>
> Otherwise looks good.
>
> Cheers,
> Jorn
>
> On 10/01/2020 00:56, Maurizio Cimadamore wrote:
>> And here's a new revision - I realized that I was not using the BB 
>> API correctly and was not multiplying the index of the getInt by the 
>> carrier size.
>>
>> http://cr.openjdk.java.net/~mcimadamore/panama/8219852_part2_v3/
>>
>> Maurizio
>>
>> On 09/01/2020 21:31, Maurizio Cimadamore wrote:
>>> I have uploaded a new revision of the benchmark. I've now changed 
>>> both LoopOverConstant and LoopOverNonConstant to use int instead of 
>>> byte as a carrier, as the byte case is specialized in the BB API 
>>> (bound check is intrinsified), so I think int is a more 
>>> representative and complex case.
>>>
>>> I also added baseline cases for unsafe in the LoopOverNonConstant as 
>>> well.
>>>
>>> http://cr.openjdk.java.net/~mcimadamore/panama/8219852_part2_v2/
>>>
>>> Maurizio
>>>
>>> On 09/01/2020 17:41, Maurizio Cimadamore wrote:
>>>> Here's the benchmark which tests constant segments.
>>>>
>>>> http://cr.openjdk.java.net/~mcimadamore/panama/8219852_part2/
>>>>
>>>> I've also tweaked your benchmark to test both loop case and single 
>>>> access case. To do that, I slightly changed the benchmark so that 
>>>> the benchmark state keeps track of the address, rather than the 
>>>> segment (to avoid calls to baseAddress() - which is not there in 
>>>> the other benchmark).
>>>>
>>>> Maurizio
>>>>
>>>> On 09/01/2020 15:37, Maurizio Cimadamore wrote:
>>>>> Looks good!
>>>>>
>>>>> Maurizio
>>>>>
>>>>> On 09/01/2020 15:21, Jorn Vernee wrote:
>>>>>> On 09/01/2020 15:58, Maurizio Cimadamore wrote:
>>>>>>> Looks good and works on my machine.
>>>>>>>
>>>>>>> I'd suggest a couple of changes:
>>>>>>>
>>>>>>> * benchmarks are java/foreign, shouldn't they be 
>>>>>>> jdk.incubator.foreign, for consistency with module/package name?
>>>>>> Good point. (I copied what I had from a while back before we 
>>>>>> switched to the incubator module)
>>>>>>>
>>>>>>> * Hoisting seems general as a name - I think what you want to 
>>>>>>> test here is hoisting when segment is non-final, non-static 
>>>>>>> variable - I have a similar benchmark for true constant segments 
>>>>>>> that I'd like to upload, so we need slightly more precise names :-)
>>>>>>
>>>>>> Could do LoopOverNonConstant?
>>>>>>
>>>>>> Updated webrev: 
>>>>>> http://cr.openjdk.java.net/~jvernee/panama/webrevs/8219852/webrev.01/ 
>>>>>>
>>>>>>
>>>>>> Jorn
>>>>>>
>>>>>>>
>>>>>>> Cheers
>>>>>>> Maurizio
>>>>>>>
>>>>>>> On 09/01/2020 14:32, Jorn Vernee wrote:
>>>>>>>> make test TEST="micro:java.foreign" 
>>>>>>>> MICRO="VM_OPTIONS=--add-modules jdk.incubator.foreign"


More information about the panama-dev mailing list