in reply to Slow Code, Spreadsheet::ParseExcel, and Spreadsheet::WriteExcel


You should separate the Spreadsheet::ParseExceland Spreadsheet::WriteExcel code to see which one is causing the problem. There are a couple of things to look out for.

Spreadsheet::ParseExcel reads entire Excel files into memory and then into Perl data structures. For large files this can be slow. Run Spreadsheet::ParseExcel against filesizes of 0.5MB, 1MB, 5MB and 10MB and you'll see the effect.

Spreadsheet::WriteExcel may run slowly if it cannot create temporary files. On most OSes this doesn't happen (IIS on Windows is a known exception). See the set_tempdir() section of the documentation for information on how to detect this problem and resolve it.

See also Out of memory using Spreadsheet::ParseExcel and the Spreadsheet::ParseExcel_XLHTML module which should be quicker than Spreadsheet::ParseExcel although with fewer features.

--
John.

Replies are listed 'Best First'.
Re^2: Slow Code
by Anonymous Monk on May 02, 2012 at 22:52 UTC
    A quick way to use environment variables to get an useful temporary directory, as in Windows systems, is reading the TEMP variable:

    $workbook->set_tempdir($ENV{'TEMP'});