Hello PerlMonks,
I have inherited from another person some Perl scripts dealing with logfile manipulation. The idea is simple, read data from some text file, decode it and write the results in an Excel file. The script is working ok, but it takes a huge amount of time to finish, even though the log files are not that big (30MB max). Moreover, the script runs 10x faster on my colleague machine. I use Win32::OLE to deal with Excel manipulation as I also need to do some formatting on the output.
To find out which parts of the code are slow I have done a profiling of my application using Devel::NYTProf and I have found some interesting results. A snippet of the code is the following:
$Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OL +E->new('Excel.Application', 'Quit'); $Book = $Excel->Workbooks->Open( $templateFile ); # #decoding code here # $Book->Worksheets($sheetNumber)->Range("A$Row:E$Row")->{Value} = [[$Ti +meAbs,$TimeRel,$TimeLog,$Info,$SigValue]];
The NYTProf output for the last line of code shows something like:
"# spent 35.5s making 44688 calls to Win32::OLE::AUTOLOAD, avg 794µs/call"and a few lines below:
"# spent 454s making 22344 calls to Win32::OLE::DESTROY, avg 20.3ms/call"What I want to understand is why the AUTOLOAD function is called here? (Moreover why it is called 2 times every time the line is passed(the line is called 22344 times). Could this be related to the fact that I use Win32::OLE on a configuration on 64bits (both Windows and Excel)? Also, why is the destructor so time expensive and why is it called every time the line is executed? I suppose that some temporary objects are created there but I do not have enough experience with Win32::OLE to figure it out.
Any suggestions, hints, tutorials are welcome. Thanks.
Sebi
In reply to Win32::OLE Excel temporary objects destruction by ndts
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |