1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-29 05:21:00 +01:00

users/19059 based on users/19058: remove ineffiency with multiple * matches

This commit is contained in:
Peter Stephenson 2014-09-08 16:38:51 +01:00
parent 956829c18e
commit 8bf3595e3a
3 changed files with 23 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2014-09-08 Peter Stephenson <p.stephenson@samsung.com>
* users/19059 based on users/19058 (Paulo César Pereira de
Andrade): Src/pattern.c, Test/D02glob.ztst: remove inefficiency
with multiple "*"s in pattern matching and add test.
2014-09-07 Barton E. Schaefer <schaefer@zsh.org>
* 33122: Src/Modules/pcre.c, Test/V07pcre.ztst: typo from 32891

View file

@ -3012,6 +3012,16 @@ patmatch(Upat prog)
break;
case P_STAR:
/* Handle specially for speed, although really P_ONEHASH+P_ANY */
while (P_OP(next) == P_STAR) {
/*
* If there's another * following we can optimise it
* out. Chains of *'s can give pathologically bad
* performance.
*/
scan = next;
next = PATNEXT(scan);
}
/*FALLTHROUGH*/
case P_ONEHASH:
case P_TWOHASH:
/*

View file

@ -565,3 +565,10 @@
print $match[1]
0:(#q) is ignored completely in conditional pattern matching
>fichier
# The following should not cause excessive slowdown.
print glob.tmp/*.*
print glob.tmp/**************************.*************************
0:Optimisation to squeeze multiple *'s used as ordinary glob wildcards.
>glob.tmp/ra=1.0_et=3.5
>glob.tmp/ra=1.0_et=3.5