[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [awipsldm] Re: LDM Observations and Comments (fwd)




===============================================================================
Robb Kambic                                Unidata Program Center
Software Engineer III                      Univ. Corp for Atmospheric Research
address@hidden             WWW: http://www.unidata.ucar.edu/
===============================================================================

---------- Forwarded message ----------
Date: Mon, 07 Feb 2000 15:37:38 -0700
From: Russ Rew <address@hidden>
To: Ken Waters <address@hidden>
Subject: Re: [awipsldm] Re: LDM Observations and Comments 

Ken,

A few other things that might speed up your perl scripts invoking
"system":

 - Use "exec" instead of system, to save an extra invocation of "sh"
   for every system call

 - Use "/bin/mv" instead of "mv", etc., to make sure exec doesn't
   invoke "sh" just to find where the executables are in your PATH.

 - Instead of 

    system("mv $work/$path/$filenm.8.txt $work/$path/$filenm.9.txt");
    system("mv $work/$path/$filenm.7.txt $work/$path/$filenm.8.txt");
    system("mv $work/$path/$filenm.6.txt $work/$path/$filenm.7.txt");
    system("mv $work/$path/$filenm.5.txt $work/$path/$filenm.6.txt");
    system("mv $work/$path/$filenm.4.txt $work/$path/$filenm.5.txt");
    system("mv $work/$path/$filenm.3.txt $work/$path/$filenm.4.txt");
    system("mv $work/$path/$filenm.2.txt $work/$path/$filenm.3.txt");
    system("mv $work/$path/$filenm.1.txt $work/$path/$filenm.2.txt");
    system("cp $temp/$filenm.tmp $work/$path/$filenm.1.txt");

   use a separate shell script that has all the above in it and just
   invoke that with a single "system" or "exec" call, using only half
   as many processes.  A separate shell script could also just cd to
   $work/$path/ first, and then all the mv commands would take place
   in the same directory, saving many file system accesses looking in
   the nested directories.

--Russ