Sorry, I wasn't clear in my question.
I mean: A have a big array of doubles in Java( eg. "X") I have two
options:
1) Pass the array to C++ in the native functinon call. eg.
public static native void solveNLPnative(double X[]).
2) Define a getX() method in Java and call this method from C++.
Since this operation will be done many times and "X" could be huge, I
would like to know which of the options is faster.
Thanks
> > I'm developping a JNI and I would like to know which is faster:
> >
[quoted text clipped - 8 lines]
> know whether to pass the array itself or ...? (What do you mean by
> "calling this array from c++"?)
Bill Medland - 15 Aug 2006 18:31 GMT
> Sorry, I wasn't clear in my question.
>
[quoted text clipped - 8 lines]
> would like to know which of the options is faster.
> Thanks
(Warning; I am still new to all this, but)
Personally I don't see that it should make any real difference. If it is
really important you will need to test both.
NB don't forget that in both cases you will actually get a reference to the
Java array itself and you will have to call GetDoubleArrayElements and
ReleaseDoubleArrayElements to get at the underlying array.
So an important question is whether you are merely reading the array or are
actually modifying it.
It seems to me that the potential choke is GetDoubleArrayElements, which you
are going to need whichever method you choose.
>> > I'm developping a JNI and I would like to know which is faster:
>> >
[quoted text clipped - 11 lines]
>> --
>> Bill Medland

Signature
Bill Medland