There's a good chance that replacing 1000 slow calls with one would help. I don't see any way of building a Perl hash, but you can return a list (using a "[]" return value) from which you can build the hash.
Using the above method, you'd still have to pass as many values as before. If that's the slow part, you could serialise the data for the hash into a single string on the Java side, then deserialise it on the Perl side. Then you only have one call, and only one value is exchanged between Java and Perl. This is of course far more complicated and error prone.
No guarantees.
| [reply] |
Thanks, replacing n Java calls with 1 call sounds good.
| [reply] |
Is there any way to reduce the time taken by each getter call ?
No.
You're dealing with 2 independent virtual machines, and glue to connect them, and that is always going to be slow and memory hungry.
or Is there any way through which I can convert the Java objects into hash directly ?
Maybe theoretically (in the sense that anything is possible), but not in any practical way.
| [reply] |
| [reply] |
If it is not possible with Inline::Java, is there any other way ?
No.
Well, maybe if you're an expert c-programmer, know how to get netbeans objects from JVM, and know enough perl5 details to make perl hash using C, then maybe you can get something working .... and then you've reinvented Inline::Java :)
More practical solution would be to try the simple things like ikegami suggests.
I don't know much about netbeans, but it would be faster if you could eliminate the java middle man altogether and connect directly from perl (or c/c++/xs), but its likely quite a bit more work
| [reply] |