JNI wrapper class

Discussion in 'Java' started by Jim, Sep 11, 2005.

  1. Jim

    Jim Guest

    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,
     
    Jim, Sep 11, 2005
    #1
    1. Advertising

  2. Jim

    Roedy Green Guest

    On Sun, 11 Sep 2005 18:06:41 -0400, "Jim"
    <> 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.
     
    Roedy Green, Sep 12, 2005
    #2
    1. Advertising

  3. On Mon, 12 Sep 2005 03:38:29 +0000, Roedy Green wrote:

    > On Sun, 11 Sep 2005 18:06:41 -0400, "Jim"
    > <> 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"
     
    Stefan Schulz, Sep 12, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Hunsley

    IBM's JNI fails where Sun's JNI works

    Alex Hunsley, Nov 3, 2003, in forum: Java
    Replies:
    4
    Views:
    882
    Alex Hunsley
    Nov 4, 2003
  2. Pasturel Jean-Louis

    Porting JNI Windows under JNI LINUX + Wine ?

    Pasturel Jean-Louis, Feb 29, 2004, in forum: Java
    Replies:
    5
    Views:
    943
    Pasturel Jean-Louis
    Mar 3, 2004
  3. Rob
    Replies:
    2
    Views:
    1,462
  4. Colby Nyce

    Trouble with JNI wrapper functions

    Colby Nyce, Sep 8, 2011, in forum: Java
    Replies:
    1
    Views:
    248
    Roedy Green
    Sep 8, 2011
  5. Philipp Kraus

    JNI C++ Wrapper

    Philipp Kraus, Sep 30, 2011, in forum: Java
    Replies:
    1
    Views:
    1,611
    Roedy Green
    Oct 10, 2011
Loading...

Share This Page