Heiko,

The reason you are having performance problems is that Inline::Java does
not actually transfer
the array over to Perl. It actually sends a 'reference' to it an calls
Java each time you want to access an element. In your case you have 4000 *
50 = 200000 elements, so that's why it's slow.

Here are things your could try:

- More Perl-Excel stuff: http://search.cpan.org/search?m=all&q=Excel&s=1

- Create a Java wrapper class that will return each row (as a tab
separated String), instead of each cell. That way you can reduce your
number of Perl-Java trips by 50.

- Use a temporary ASCII file that Perl can parse easily afterwards.


> Hi,
>
> I have to read large Excel-files (5sheet, 4000rows, 50columns) with
> perl. Misereably, the Spreadsheet::ParseExcel modules is really slow and
> memory hungry on this (> 5min parsing, > 250MB memory).
>
> Therefore I've been looking around and found the nice jakarta POI
> project, handling exactly the same problem, but in Java. Parsing is
> quite fast (~30s, 100MB) on the Java process. It was next to no problem
> to attach this to perl using Inline::Java.
>
> My problem is getting the data back from java to perl. I tried to
> transfer the data at once, so I created a String[][] per sheet and get
> it by a function to perl. But when I try to use the values, it is still
> accessing the Java process, and while parsing takes only 30s, accessing
> each value of my String[][] of one sheet takes ~2min (about 70% perl and
> 30% java cpu usage (top)). Using JNI reduced the time but it's still
> above 1min.
>
>
> Has anybody a good idea how to transfer the data with only one call to
> the JVM? Any ideas about other projects reading Excel-files by Perl are
> welcome, too. (Dropping excel is not possible, misereably.)
>
> Best regards,
>
> Heiko
>
>

Reply via email to