[foreign] Pointer to fixed-size array: is jexctract's mapping to Java correct?

Lev Serebryakov lev at serebryakov.spb.ru
Thu Feb 28 14:52:38 UTC 2019


On 28.02.2019 16:50, Maurizio Cimadamore wrote:

> On 28/02/2019 13:16, Lev Serebryakov wrote:
>> Yep. And copy data from "java native" array and back. It will dominate
>> execution time for small transform sizes, I'm afraid — copying from
>> native Java array to these pairs. Performance-wise, best solution will
>> be to have `Array<Double>` transparently backed by `double[]`, it will
>> mimic C code as close as possibly (and as fast as possibly).
> 
> So, if efficiency is your main concern, I'd suggest to:
> 
> 1) allocate a double array, as this:
> 
> Array<Double> buffer  = Scope.allocateArray(NativeTypes.DOUBLE, npairs *
> sizeofDouble * 2);
  Should it be "npairs * 2"? It is not clear, is allocateArray() takes
size in number of elements or in number of bytes.


-- 
// Black Lion AKA Lev Serebryakov



More information about the panama-dev mailing list