Hi,Steve and Dan:

Stephen Lau wrote:
> Hi Jason,
>
>>> Hm.  The command is run multiple times.  I'd probably just find a 
>>> way to
>>> not have to do that.  Something like
>>>
>>>    for dir; do
>>>        dirs="$dirs|$dir"
>>>    done
>>>    dirs=${dirs#|}
>>>    hg manifest | egrep "^($dirs)/.*/${pat#s.}\$"
>>>
>>> or something like that.  I dunno if that'd actually do what needs to 
>>> happen
>>> there.
>> Yes, it is faster.
>> Here is a time running:
>> # pwd
>>    $SRC/uts
>>
>> # time flg.flp -r
>> real    1m43.533s
>> user    1m37.697s
>> sys     0m8.441s
>>
>> It is running in my x4200, 2 times faster than before.
>>
>> And takes about 3 minutes in my DELL GX270.
>> real    2m57.556s
>> user    2m33.094s
>> sys     0m12.130s
>>
>> Could we use "echo" to take the place "hg manifest".In my test,"echo" 
>> often faster than "hg manifest" a little bit.
>
> I'm not sure I understand what you mean here by replace "hg manifest" 
> with "echo"?
It just replaced "hg manifest" with "echo",
1.put "FILELIST=`hg manifest`" once to setup a snapshot when it is 
"mercurial",E.g

SCM_MODE=`detect_scm`
......
if [[ $SCM_MODE == "unknown" ]];then
......
elif [ "$SCM_MODE" = "mercurial" ]; then
        codemgr_ws=`hg root 2>/dev/null`
        FILELIST=`hg manifest`    <---------------   put all "hg 
manifest" result to FILELIST variable at the beginning of "mercurial 
judgement"
else
        fail "No available SCM found"
fi


2.then when try to "egrep " from the $FILELIST.E.g:
   for dir; do
       dirs="$dirs|$dir"
   done
   dirs=${dirs#|}
   echo "$FILELIST" | egrep "^($dirs)/.*/${pat#s.}\$"    
<-------------------        Here,original one is 'hg manifest | egrep 
"^($dirs)/.*/${pat#s.}\$" '

In my test,"echo $FILELIST" is a little bit faster than "hg manifest" in 
my x4200 with the same "flg.flp -r" report.
############   with echo "$FILELIST" | egrep "^($dirs)/.*/${pat#s.}\$"  
##############
[root at sol-x4200-3]#time flg.flp -r

real    0m55.189s
user    0m46.166s
sys     0m11.712s
##########################################################################


############   with "hg manifest |   | egrep "^($dirs)/.*/${pat#s.}\$" 
##################
[root at sol-x4200-3]#time flg.flp -r

real    1m43.686s
user    1m37.640s
sys     0m8.640s
##########################################################################


Please correct me if something misunderstand.

Thanks
Jason

Reply via email to