Here is the algorithm that is used in the code:
if (!opendir(DIR, "$changeSetCacheDirectory")){
&Common::Error("Can't
open directory $changeSetCacheDirectory : $!");
return
$ERROR;
}
my $site = "$ENV{SPIFFCC_SITE}";
my @cs = grep { /.*_$site$/
&& -d "$changeSetCacheDirectory/$_" } readdir DIR;
closedir DIR;
#Process each user directory
foreach my $dir (@cs)
{
#
get a list of all the user's cache files
$changeSetCacheDirectory
= "$ENV{SPIFFCC_PROJDIR}/changesets/$dir";
if
(!opendir(DIR, "$changeSetCacheDirectory")){
&Common::Error("Can't open $changeSetCacheDirectory: $!");
return $ERROR;
}
my
@csets = grep { -f "$changeSetCacheDirectory/$_" } readdir DIR;
closedir
DIR;
#
process each user cache file
my
$slash = ($ENV{SPIFFCC_ARCH} =~ /^win/) ? "\\" : "/";
foreach
my $csCacheFile (@csets)
{
if (!open(F, "$changeSetCacheDirectory/$csCacheFile")){
&Common::Error("Unable to open changeset file forreading:
${changeSetCacheDirectory}${slash}$csCacheFile: $!\n");
return $ERROR;
}
while (<F>)
{
if ($_ =~ /^$criteria=/){
push(@$list, $csCacheFile) if (m/$keyword/);
last;
}
}
close(F);
}
}
This is done both in Windows NT/2000 and UNIX. The problem is that there
is a large amount of directories and
files. Today there are ~400 files and ~9000 files and growing on a
daily basis. When this code executes in UNIX
it takes on average 23 seconds. The problem is Windows: it takes 8-9
minutes to perform the same piece of
code. I'm a relative newbie at Perl and I have been trying to read
and find a better solution because the
execution time for Windows is unacceptable.
Can someone suggest a better and faster solution for the above problem.
Your help would be appreciated. Thank you
Walter
--
Walter Usyk - Tools Developer
Software Development Environment Tools (1P67)
email: [EMAIL PROTECTED]
ESN: 398-4603
Tel: (613) 768-4603