From: | Beckett Richard-qswi266 <Richard.Beckett [...] motorola.com> |
To: | "'bug-Win32-OLE [...] rt.cpan.org'" <bug-Win32-OLE [...] rt.cpan.org> |
Subject: | use Win32::OLE::Const 'Microsoft Excel'; Takes 75 seconds!! |
Date: | Tue, 14 Sep 2004 11:14:57 +0100 |
Hi,
This script:...
use Win32::OLE::Const 'Microsoft Excel';
print xlExtractData."\n";
Takes 75 seconds to execute!
I did this:
perl -D:Prof test1.pl
dprofpp -r tmon.out
and got this result:
Exporter::export has -1 unstacked calls in outer
Exporter::Heavy::heavy_export has 1 unstacked calls in outer
Total Elapsed Time = 74.89209 Seconds
Real Time = 74.89209 Seconds
Exclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c Name
99.4 74.45 74.454 538 0.1384 0.1384 Win32::OLE::Const::_Typelib
0.36 0.268 74.722 1 0.2678 74.721 Win32::OLE::Const::_Typelibs
0.07 0.051 0.051 1 0.0510 0.0510 Win32::OLE::Const::_LoadRegTypeLib
0.05 0.040 0.040 1 0.0400 0.0400 Win32::OLE::Const::_Constants
0.04 0.030 74.892 1 0.0300 74.892 main::BEGIN
0.03 0.020 0.050 3 0.0066 0.0165 Win32::OLE::Const::BEGIN
0.01 0.010 0.010 2 0.0050 0.0050 Config::fetch_string
0.01 0.010 0.010 2 0.0050 0.0050 DynaLoader::BEGIN
0.01 0.010 0.010 3 0.0033 0.0033 vars::BEGIN
0.00 0.000 0.000 1 0.0000 0.0000 Exporter::Heavy::heavy_export
0.00 - -0.000 1 - - Config::TIEHASH
0.00 - -0.000 1 - - DynaLoader::dl_load_file
0.00 - -0.000 1 - - DynaLoader::dl_install_xsub
0.00 - -0.000 1 - - warnings::BEGIN
0.00 - -0.000 1 - - Config::import
My system:
XPpro SP1 with 512 Mb memory, an Intel(R) Pentium(R) M processor 1600MHz with a bus speed of 797 MHz, activeperl v5.8.4 build 810.
D:\>perl -MWin32::OLE=999
Win32::OLE version 999 required--this is only version 0.1701 at C:/Perl/lib/Exporter/Heavy.pm line 121.
BEGIN failed--compilation aborted.
After a lot of fiddling about, I have found 2 things that make a difference.
1. Remove the network cable from my PC. Then the 2 line script runs in ~5 seconds.
2. Modify C:\Perl\site\lib\Win32\OLE\Const.pm, and change this line:
return unless -f $filename || $filename !~ /^\w:\\.*\.(exe|dll)$/;
to this:
return unless $filename !~ /^\w:\\.*\.(exe|dll)$/;
and the 2 liner runs instantaneously.
For now, can I safely use this workaround to speed things up, or is it safer to use the -f test, and simply put up with the delay?
Feel free to contact me if you need any more information.
Thanks,
R.