Hi!

----

Attached (as "slow_pattern_selector001.sh.txt") is a small script which
takes around 2-3 minutes here to complete while we expected that it may
only take a second or less.
It seems the problem is related to the use of "pattern selectors"
(erm... what is the correct name for this feature ?), e.g.
"${str/~(E)(pattern1)(pattern2)(pattern3)\2}".
The performance problem gets worse woth longer patterns, e.g. the
selectors in the script need 2-3 seconds to complete and larger ones may
need even 15 seconds... ;-(

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [email protected]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)
function parse_findls
{
        nameref out=$1
        typeset str="$2"
        
        out.inode="${str/~(Elr) *([[:digit:]]*) *([[:digit:]]*) 
*([[:alpha:]-]*) *([[:digit:]]*) *([[:alnum:]]*) *([[:alnum:]]*) 
*([[:digit:]]*) *([[:alpha:]]* *[[:digit:]]* *[[:digit:]:]*) *(.*)/\1}"
        out.blocks="${str/~(Elr) *([[:digit:]]*) *([[:digit:]]*) 
*([[:alpha:]-]*) *([[:digit:]]*) *([[:alnum:]]*) *([[:alnum:]]*) 
*([[:digit:]]*) *([[:alpha:]]* *[[:digit:]]* *[[:digit:]:]*) *(.*)/\2}"
        out.mode="${str/~(Elr) *([[:digit:]]*) *([[:digit:]]*) *([[:alpha:]-]*) 
*([[:digit:]]*) *([[:alnum:]]*) *([[:alnum:]]*) *([[:digit:]]*) *([[:alpha:]]* 
*[[:digit:]]* *[[:digit:]:]*) *(.*)/\3}"
        out.numlinks="${str/~(Elr) *([[:digit:]]*) *([[:digit:]]*) 
*([[:alpha:]-]*) *([[:digit:]]*) *([[:alnum:]]*) *([[:alnum:]]*) 
*([[:digit:]]*) *([[:alpha:]]* *[[:digit:]]* *[[:digit:]:]*) *(.*)/\4}"
        out.user="${str/~(Elr) *([[:digit:]]*) *([[:digit:]]*) *([[:alpha:]-]*) 
*([[:digit:]]*) *([[:alnum:]]*) *([[:alnum:]]*) *([[:digit:]]*) *([[:alpha:]]* 
*[[:digit:]]* *[[:digit:]:]*) *(.*)/\5}"
        out.group="${str/~(Elr) *([[:digit:]]*) *([[:digit:]]*) 
*([[:alpha:]-]*) *([[:digit:]]*) *([[:alnum:]]*) *([[:alnum:]]*) 
*([[:digit:]]*) *([[:alpha:]]* *[[:digit:]]* *[[:digit:]:]*) *(.*)/\6}"
        out.filesize="${str/~(Elr) *([[:digit:]]*) *([[:digit:]]*) 
*([[:alpha:]-]*) *([[:digit:]]*) *([[:alnum:]]*) *([[:alnum:]]*) 
*([[:digit:]]*) *([[:alpha:]]* *[[:digit:]]* *[[:digit:]:]*) *(.*)/\7}"
        out.date="${str/~(Elr) *([[:digit:]]*) *([[:digit:]]*) *([[:alpha:]-]*) 
*([[:digit:]]*) *([[:alnum:]]*) *([[:alnum:]]*) *([[:digit:]]*) *([[:alpha:]]* 
*[[:digit:]]* *[[:digit:]:]*) *(.*)/\8}"
        out.filename="${str/~(Elr) *([[:digit:]]*) *([[:digit:]]*) 
*([[:alpha:]-]*) *([[:digit:]]*) *([[:alnum:]]*) *([[:alnum:]]*) 
*([[:digit:]]*) *([[:alpha:]]* *[[:digit:]]* *[[:digit:]:]*) *(.*)/\9}"
        return 0
}

typeset -a data=(
'1342907    2 -r--r--r--   1 test001  users        1146 Jun  8 12:48 
./.svn/text-base/Makefile.svn-base'
'1342904    1 -r--r--r--   1 test001  users         370 Jun  8 12:48 
./.svn/entries'
'1342906    1 -r--r--r--   1 test001  users           2 Jun  8 12:48 
./.svn/format'
'1342911    2 -rw-r--r--   1 test001  users        1146 Jun  8 12:48 ./Makefile'
'1343619   13 -rwxr-xr-x   2 test001  users       13224 Jun  8 22:26 ./ksh93'
'1343619   13 -rwxr-xr-x   2 test001  users       13224 Jun  8 22:26 ./ksh'
'1343813 5152 -rw-------   1 test001  users     5263486 Jun  8 20:42 ./core'
'1343777    4 -rw-r--r--   1 test001  users        3224 Jun  8 13:24 ./pmain.o'
'1343614  136 -rw-r--r--   1 test001  users      124267 Jun 10 04:29 
./testshell.log'
'1343878    9 -rw-r--r--   1 test001  users        8635 Jun 10 04:29 
./.make.state'
)

integer i

for (( i=0 ; i < ${#da...@]} ; i++ )) ; do
        compound parsed_data
        parse_findls parsed_data "${data[i]}"
done

print "#done"

_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to