[foreign] Some benchmarks for Foreign vs JNA (vs pure java implementation)

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Wed Mar 13 16:07:46 UTC 2019


Hi Lev,
just out of curiosity I tried to use your benchmark on the experimental 
method added by the patch I've shared earlier this week.

I've added one more benchmark to the Panama class:

@Benchmark
     public void FullBulk(BenchState state) {
         Array.assign(state.ji, state.i);
         fftw_execute(state.p);
         Array.assign(state.o, state.jo);
     }

The results are here - I did not do a full run - just tested with size = 
1024 and inPlace = false. Also, these results are on Linux (Ubuntu 18.04).

http://cr.openjdk.java.net/~mcimadamore/panama/fftw-bulk.txt

Seems like Panama is marginally faster than JNA. In the FFTOnly case the 
speedup is bigger, and I suspect you were not seeing that on Windows 
because Windows doesn't have the direct invoker backend optimization. 
But when LinkToNative will be merged in, the numbers should improve 
across the board, Windows included (at which point we can bin the direct 
invoker backend which only really works on Linux/Mac).

I'll wait for your input, but it seems that adding fast paths for doing 
bulk array copy is the way to go for cases like these.

Maurizio

On 11/03/2019 18:14, Maurizio Cimadamore wrote:
>
> On 11/03/2019 17:42, Lev Serebryakov wrote:
>> On 11.03.2019 20:12, Maurizio Cimadamore wrote:
>>
>>   Thank you!
>>
>>> I don't know if you can build panama yourself Lev, but it'd be really
>>> nice if we could get some validation of this approach, before
>>> considering its addition into the public API.
>>   I'll try to build it myself, but not till weekend, I have very busy
>> week at $paidWork.
>
> Thanks!
>
> Maurizio
>
>>


More information about the panama-dev mailing list