Performance improvement to unchecked segment ofNativeRestricted
Ty Young
youngty1997 at gmail.com
Wed Jan 6 01:59:41 UTC 2021
You may also need to override checkValidState from
AbstractMemorySegmentImpl in EverythingSegment. checkValidState calls
the scope's checkValidState and since scope is null, you'll get a NPE.
The list of methods that call checkValidState include:
splitterator
mismatch
address
handoff
share
registerCleaner
close
In short, if you do basically anything but simply read/write via
VarHandle, including native library usage which uses address(), you're
going to get a NPE.
On 1/5/21 4:32 PM, Radosław Smogura wrote:
> Hi all,
>
> I hope you have a good day.
>
> Here I would like to present some changes to increase performance of ofNativeRestricted - my benchmarks - where I tried to simulate access from code - outpaced the access to Java array (as intended). As it looks like that pull request flow has changed, I have to sign-up OCA (and if this change is fine I would be happy to do this).
>
> Below please find benchmark results and link to "pending PR" / branch
>
> The results outpaced the Java array access.
>
> Benchmark Mode Cnt Score Error Units
> AccessBenchmark.foreignAddress thrpt 4 86860188.499 ± 13454393.406 ops/s
> AccessBenchmark.foreignAddressRaw thrpt 4 96150181.668 ± 7025145.700 ops/s
> AccessBenchmark.target thrpt 4 93673099.539 ± 23272596.145 ops/s```
>
> versus tests on original repo
>
> Benchmark Mode Cnt Score Error Units
> AccessBenchmark.foreignAddress thrpt 4 81907199.092 ± 2663269.652 ops/s
> AccessBenchmark.foreignAddressRaw thrpt 4 83629168.611 ± 1025857.535 ops/s
> AccessBenchmark.target thrpt 4 94023553.582 ± 6128411.421 ops/s
>
> https://github.com/openjdk/panama-foreign/pull/431
> [https://avatars2.githubusercontent.com/u/41768318?s=400&v=4]<https://github.com/openjdk/panama-foreign/pull/431>
> [WIP] Performance improvement to unchecked segment ofNativeRestricted by rsmogura · Pull Request #431 · openjdk/panama-foreign<https://github.com/openjdk/panama-foreign/pull/431>
> Here's a proposition to tune the access to global scope. This changes, could help to outpace the access to Java arrays using [] operator. The results outpaced the Java array access. Benchmark ...
> github.com
>
> Kind regards,
> Rado
More information about the panama-dev
mailing list