[foreign-memaccess+abi] RFR: Performance improvement to unchecked segment ofNativeRestricted [v2]
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Sat Jan 16 15:11:29 UTC 2021
On Sat, 16 Jan 2021 15:06:38 GMT, Radoslaw Smogura <github.com+7535718+rsmogura at openjdk.org> wrote:
> > Hi. I've added the benchmarks:
> > ```
> > * benchmarks used by me;
> >
> > * added a new benchmarks to `LoopOverNonConstant` to compare performance of this approach with existing methods for getting values.
> > ```
>
> It's strange to see the performances of global segment to be worse than that of a regular segment?
Ah! I think I know what's happening here. In principle, the original implementation should have been just as good - but there's one issue: since the everything segment has length of Long.MAX_VALUE it is, by definition, not a SMALL segment - which means the internal optimizations that are aimed at working around the hotspot limitations around int vs. long loops will not work for the everything segment. That's why it was 2x slower. Your patch removes _some_ of these factors, but not _all_ of them. And I think the updates to LoopOverNonConstants are wrong - as you are essentially trying to use a strided VarHandle in an absolute way (see code comment).
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/437
More information about the panama-dev
mailing list