suaveant has asked for the wisdom of the Perl Monks concerning the following question:

One of our departments has a Java API that I need to access... it is rather complex (overly so if you ask me, but it IS Java). I have it working under Inline::Java but at a noticeable slowdown.

I looked into Java::Import but could not for the life of me get it to install... has anyone used it before, and is it faster than Inline::Java. Is it worth my while to get it compiled and recode the wrapper?

Is there anything better out there I should be looking into?

                - Ant
                - Some of my best work - (1 2 3)

Replies are listed 'Best First'.
Re: Something better than Inline::Java
by Fletch (Bishop) on Apr 30, 2007 at 21:54 UTC

    Just to toss out an idea: you might try tossing out trying to include the Java stuff in your Perl process and instead try writing a small dedicated pure-Java program which provides an XML-RPC or SOAP bridge to the API and have your Perl access that instead.

    (No experience with Inline::Java or the other you mention so I can't help there . . .)

      The SOAP server they made is 10 times slower than the Inline::Java version I did... and 70 times slower than the pure Java... SOAP isn't much of a speed solution.

                      - Ant
                      - Some of my best work - (1 2 3)

Re: Something better than Inline::Java
by mpeters (Chaplain) on May 01, 2007 at 01:18 UTC

    How are you using Inline::Java? Client/Server ? JNI? Shared JVM? Are you using it from a standalone Perl script? CGI script? mod_perl handler?

    All of these things affect the way it will interact. I've found JNI to usually be the fastest, but it's a little tricky to get right under mod_perl.

    Have you tried asking your question on the inline mailing list where the real gurus of Inline::Java hang out?


    -- More people are killed every year by pigs than by sharks, which shows you how good we are at evaluating risk. -- Bruce Schneier
      OOOh... JNI gives me a 20 percent speedup, thanks!

      It will most likely be used as a standalone script to generate product files, so it should be fine.

      I had sent a message to the list but it didn't seem to go through (maybe I sent it too soon after subscribe), I will have to try again. Thanks.

                      - Ant
                      - Some of my best work - (1 2 3)