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

VARARR in pattern code



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