Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   JNI wrapper class (http://www.velocityreviews.com/forums/t146125-jni-wrapper-class.html)

Jim 09-11-2005 10:06 PM

JNI wrapper class
 
Am writing a JNI wrapper class.
Are there any performance advantages of the JNI C routine calling a Java
method to set some variables all at once, or using SetIntField,
SetByteField, etc, to set the variables?

Which is normally recommended? Much less code to just call the method.

Thanks,



Roedy Green 09-12-2005 03:38 AM

Re: JNI wrapper class
 
On Sun, 11 Sep 2005 18:06:41 -0400, "Jim"
<j1mw_no_spam_plz@bellsouth.net> wrote or quoted :

>Which is normally recommended? Much less code to just call the method.


the fewer the number of JNI calls the faster the code will be.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Stefan Schulz 09-12-2005 09:37 AM

Re: JNI wrapper class
 
On Mon, 12 Sep 2005 03:38:29 +0000, Roedy Green wrote:

> On Sun, 11 Sep 2005 18:06:41 -0400, "Jim"
> <j1mw_no_spam_plz@bellsouth.net> wrote or quoted :
>
>>Which is normally recommended? Much less code to just call the method.

>
> the fewer the number of JNI calls the faster the code will be.


That is right. However, the more atomic the native call, the less time is
spend in the most tedious and complicated debugging process i know
(ideally, none).

I am all for speed, but when it comes to JNI, i usually wrap as tightly as
i can, often creating a (private, static) method per native function.

--
You can't run away forever,
But there's nothing wrong with getting a good head start.
--- Jim Steinman, "Rock and Roll Dreams Come Through"




All times are GMT. The time now is 05:06 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.