Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: replacement slowdown
- X-seq: zsh-workers 21167
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: replacement slowdown
- Date: Sat, 23 Apr 2005 17:12:06 +0000
- In-reply-to: <20050423162635.GA30862@xxxxxxxxxxx>
- 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>
On Apr 23, 12:26pm, Clint Adams wrote:
}
} > What's calling pattryrefs() 28000+ times? Is that how many lines there
} > are in /tmp/blah?
}
} 231 lines, but 57093 chars. pattrylen() seems to be called 57092 times
} by igetmatch.
OK, that makes sense. igetmatch() has a for() loop that, when asked to
find every possible match within the string (e.g. by ${...//...}), calls
the pattern comparison once at every possible matching position. Since
the pattern is only one character long (/,/), it calls it once for each
character in the string.
But pattry() recomputes the unmetafied length of the *entire* string on
each call. So that length computation is going to have to be factored
out of pattry(), possibly by storing it in the Patprog the way that's
done for set_pat_start() and set_pat_end().
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
Messages sorted by:
Reverse Date,
Date,
Thread,
Author