Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: 6-pws-2



Peter Stephenson wrote:

> - I haven't looked at the speed of the new pattern matching code.  If case
>   statements with *only* simple strings are slower, there's not much I can
>   do since it's already optimised to a strcmp(), though I think I can speed
>   up the string-building loop in patcompatom().  In other cases I can think
>   of a few tweaks.

I think we could

1) come back to my old suggestion to optimise some common patterns
   (like *str, str*, *str*, s1|s2|s3) in the same way non-pattern
   strings are already optimised
2) probably add caches for parsed patterns (e.g. give patcompile() an
   optional pointer to a patcache struct which would contain the
   strings and compiled pattern of the last few patterns used at the
   call site and make patcompile() first look there)
3) store compiled patterns in the execution tree (for now I'm only
   thinking about `case', `[[ .. = .. ]]' and `[[ .. != .. ]]' if the
   patterns don't need to be singsub()ed, which could be checked at
   parse time)

I haven't tried any of these so I'm not sure if they are worthwhile
and easy (and small) enough to implement. Just some thoughts.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author