[vtkusers] vtkUnsignedShortArray GetJavaArray() performance
Marco Sambin
m.sambin at gmail.com
Mon Jan 23 13:23:13 EST 2012
Update: actually I was making a mistake.
The short[] array I was requesting with GetJavaArray() was actually
much larger than what I stated in my previous post, due to a mistake
in my code.
After fixing the code, GetJavaArray() on a 512x512
vtkUnsignedShortArray takes around 1 millisecond on my machine, which
seems acceptable.
Sorry for the misleading post.
Regards,
Marco
2012/1/23 Marco Sambin <m.sambin at gmail.com>:
> Hi all.
> I am experiencing some performance issues with the call to
> vtkUnsignedShortArray's GetJavaArray() method.
>
> On my PC, this GetJavaArray is taking around 3 milliseconds in case of
> a vtkUnsignedShortArray representing a 256x256 image (hence, 65536
> elements), while it is taking around 300 milliseconds (!!) in case of
> a vtkUnsignedShortArray representing a 512x512 image (hence, 262144
> elements).
>
> Is this huge performance difference between 256x256 and 512x512 arrays
> to be expected with the GetJavaArray() method?
>
> I understand that here most of the performance penalty may be due to
> the Java-to-native crossing related to the JNI mechanism, but why such
> a huge difference between the two array sizes?
>
> Thanks in advance for your comments.
> Regards,
>
> Marco
More information about the vtkusers
mailing list