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

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Mon Mar 11 17:12:09 UTC 2019


Here's a possible patch to handle the use case you are after:

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

And here are some preliminary benchmarks I got with it:

10 elems

Benchmark                            Mode  Cnt        Score Error  Units
PanamaBenchmark.testPanamaArraySet  thrpt   25  2472291.287 ± 33535.447  
ops/s
PanamaBenchmark.testPanamaBulkArraySet  thrpt   25  3185245.321 ± 
96377.407  ops/s

1000 elems

Benchmark                                Mode  Cnt       Score Error  Units
PanamaBenchmark.testPanamaArraySet      thrpt   25   19600.948 ± 
315.317  ops/s
PanamaBenchmark.testPanamaBulkArraySet  thrpt   25  147176.368 ± 
445.289  ops/s


Where testPanamaArraySet does the thing you did in your bench (elem by 
elem set), whereas testPanamaBulkArraySet uses the new API point Array.copy.

As Jorn pointed out, we might even not need a new API point after all, 
and just make the BoundedArray::copyFrom smarter if layouts matches the 
layout of the Java values stored in the Java array (e.g. provide a bunch 
of specialized versions).

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.

Cheers
Maurizio

On 11/03/2019 15:09, Maurizio Cimadamore wrote:
>
> On 11/03/2019 14:32, Lev Serebryakov wrote:
>>   First of all, I didn't mean criticize Panama work in any way
>
> Sure! It is important that we receive this kind of feedback early in 
> the cycle, so that we can find ways to address it.
>
> I'm already working on something that seems promising, and simple 
> enough to do - I will share more once I have some concrete results.
>
> Thanks again.
> Maurizio
>


More information about the panama-dev mailing list