Performance of memory var handles in hot loops

Jorn Vernee jorn.vernee at oracle.com
Wed Apr 8 11:21:48 UTC 2020


When talking about 'long loop' we mean a loop that has a long as an 
index variable e.g.:

for (long l = 0; l < SIZE; l++) {
       // use l
   }

Though, there are some other optimizations applied as well to 
calculations inside the loop, specifically the ones that use ints as 
inputs. These optimizations don't currently work for long inputs.

Both of these cases need to be addressed eventually, but the former 
seems to be the more complex one of the two.

Jorn

On 08/04/2020 12:52, Antoine Chambille wrote:
> Thank you for the information.
>
> Looking forward to when all the pieces will come together. It's a bit magic
> at the moment, in a good way, and in a puzzling way ;)
>
> Does this microbenchmark qualify as a 'long loop' ? Even though the i
> counter of the loop is an int?
>
>
> Yes the vector API works well on native memory exposed as byte buffers,
> performance is better than scalar but not yet on par with the vector API on
> arrays. I have actually tried it recently on the same kind of benchmark.
> http://mail.openjdk.java.net/pipermail/panama-dev/2020-March/007786.html.
> That's when John Rose mentioned that the vector API would support memory
> segments, and hinted that it would be the preferred way to use the vector
> API on native memory.
>
> Cheers,
> -Antoine
>
>
>
>
>
>
> On Wed, Apr 8, 2020 at 12:21 PM Maurizio Cimadamore <
> maurizio.cimadamore at oracle.com> wrote:
>
>> On 08/04/2020 08:58, Antoine Chambille wrote:
>>> I'm not too worried about that because the panama vector API is
>>> coming. By the way is there already a prototype of the Vector API that
>>> works on memory segments?
>> No, I think ATM the vector API doesn't have a way to load a vector from
>> a memory segment. That said, IIRC it has ways to load it from a
>> ByteBuffer and you can turn the segment into a BB (provided it fits into
>> a 32-bit size).
>>
>> I did some experiments in the past about bridging the two APIs, the
>> results I got were a bit hit and miss but it was a long time ago - maybe
>> it's time to do another attempt.
>>
>> Maurizio
>>
>>


More information about the panama-dev mailing list