Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [BUG] Long line makes pattern matching (by //) hog Zsh
- X-seq: zsh-workers 38616
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: [BUG] Long line makes pattern matching (by //) hog Zsh
- Date: Sun, 5 Jun 2016 12:10:20 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=90SKtWiCUqe5g4cNoZ2N069erzItzxC0Rl7Rc2sMPGs=; b=NX0Ua1pOgQkKTX5WwIj2lvRuSEl4fsAU7A8UpDt+oy57ksNPZZd8BFqSQxfaSNQp+s oqgK/W6EiFahqoS/OJJQVXCQE6rDmEjbLLw/MbSv4J+AV2vFY80AMFh01qZOxc7U8IS6 CXA69csyBxaKslXeY8ryfRcEjY0MWdK8k6RNpsRYdWLyCojgNIacAQjZaCy1ufyC6MJL z9ZSb2YiJUYWpc6uQLuazL7tn/ICbf4RPJR4zGquo09pMeyi+spM4dd0udVxP105YynN xs8Xvep0eU/kHizT5cfjKGY0amqMN+p9IJmZd8eQD2uwNH9/s6fw+3FK+q4cBQPkxe+q FV6g==
- In-reply-to: <CAKc7PVC=AES1LhY7tYTXrPsefX3CXgtUsxiVbDaxmc5o2iHnVw@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
- References: <CAKc7PVC=AES1LhY7tYTXrPsefX3CXgtUsxiVbDaxmc5o2iHnVw@mail.gmail.com>
On Jun 5, 4:36pm, Sebastian Gniazdowski wrote:
}
} 1. not backslash nor slash nor space [^ /\\\\]##
} 2. not number, slash, backslash, space [^0-9/\\\\ ]##
} 3. not slash, backslash [^/\\\\]#
} 4. end of line (#e)
It's in the block in pattern.c:patchmatch() that begins with the
comment:
/*
* Lookahead to avoid useless matches. This is not possible
* with approximation.
*/
Specifically, in the "if (no >= min) for (;;) ..." loop, at each charater
in the input string patmatch() is called recursively to look at the rest
of the string, which again enters this same loop because the next thing
is also a one-or-more expression, which calls recursively and again
enters the loop because the thing after that is a zero-or-more.
It consumes a LOT of memory while doing this, even if I add a hack to
prevent it from recursively re-entering lookahead (or to skip the
lookahead entirely).
Messages sorted by:
Reverse Date,
Date,
Thread,
Author