Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
VARARR in pattern code
- X-seq: zsh-workers 33130
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: Zsh Hackers' List <zsh-workers@xxxxxxx>
- Subject: VARARR in pattern code
- Date: Mon, 08 Sep 2014 15:10:37 +0100
- In-reply-to: <CAHAq8pF=hB4sfx+Fe6nfnbJ8W7E9r9e_mHytBdu=Oy_6CWukJA@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- Organization: Samsung Cambridge Solution Centre
- References: <CAHAq8pF=hB4sfx+Fe6nfnbJ8W7E9r9e_mHytBdu=Oy_6CWukJA@mail.gmail.com>
While looking at the problem with repeated *'s, I notice that inside the
pattern code for closures --- *'s, #'s and ##'s --- there's a VARARR.
/*
* Array to record the start of characters for
* backtracking.
*/
VARARR(char, charstart, patinend-patinput);
If you're interested, that was added to fix a very similar problem with
pathological backtracking involving negated matches with "~" or "^".
It's otherwise a strange thing to have in pattern matching code (and
it may be why the performance with multiple "*"s was quite so bad).
We just made all VARARR's heap allocation. It occurs to me this one can
be hit a lot of times when backtracking through a pattern with a lot of
closures. I wonder if this one should be a special case --- zalloc if
efficient enough? I haven't done any experiments so may be being
alarmist.
It might be possible to optimise the use of charstart out entirely
in some cases.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author