Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: replacement slowdown
- X-seq: zsh-workers 21174
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: replacement slowdown
- Date: Sun, 24 Apr 2005 16:46:43 +0000
- In-reply-to: <1050424033218.ZM24729@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20050422232316.GA27665@xxxxxxxxxxx> <1050423031422.ZM3881@xxxxxxxxxxxxxxxxxxxxxxx> <20050423031907.GA27233@xxxxxxxxxxx> <1050423160721.ZM4469@xxxxxxxxxxxxxxxxxxxxxxx> <20050423162635.GA30862@xxxxxxxxxxx> <1050423171206.ZM5141@xxxxxxxxxxxxxxxxxxxxxxx> <20050424003350.A87A28638@xxxxxxxxxxxxxxxxxxxxxxxx> <1050424004746.ZM24638@xxxxxxxxxxxxxxxxxxxxxxx> <1050424033218.ZM24729@xxxxxxxxxxxxxxxxxxxxxxx>
On Apr 24, 3:32am, Bart Schaefer wrote:
}
} I agree Peter's solution is simpler, but I think it ought to get merged
} with my extra METAINC()s and related changes.
Here's that patch:
Index: Src/glob.c
--- ../zsh-forge/current/Src/glob.c Sun Apr 24 09:22:59 2005
+++ Src/glob.c Sun Apr 24 09:41:32 2005
@@ -2293,6 +2293,8 @@
* There's no optimization here. */
for (ioff = uml, t = s + l, umlen = 0; t >= s;
t--, ioff--, umlen++) {
+ if (t > s && t[-1] == Meta)
+ t--;
set_pat_start(p, t-s);
if (pattrylen(p, t, s + l - t, umlen, ioff)) {
*sp = get_match_ret(*sp, t - s, l, fl, replstr);
@@ -2308,7 +2310,7 @@
* move forward along string until we get a match. *
* Again there's no optimisation. */
for (ioff = 0, t = s, umlen = uml; t < s + l;
- ioff++, t++, umlen--) {
+ ioff++, METAINC(t), umlen--) {
set_pat_start(p, t-s);
if (pattrylen(p, t, s + l - t, umlen, ioff)) {
*sp = get_match_ret(*sp, t-s, l, fl, replstr);
@@ -2336,7 +2338,7 @@
do {
/* loop over all matches for global substitution */
matched = 0;
- for (; t < s + l; t++, ioff++, umlen--) {
+ for (; t < s + l; METAINC(t), ioff++, umlen--) {
/* Find the longest match from this position. */
set_pat_start(p, t-s);
if (pattrylen(p, t, s + l - t, umlen, ioff)) {
Messages sorted by:
Reverse Date,
Date,
Thread,
Author