zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: Zsh Hackers' List <zsh-workers@zsh.org>
Subject: VARARR in pattern code
Date: Mon, 08 Sep 2014 15:10:37 +0100	[thread overview]
Message-ID: <20140908151037.5ec31e8a@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <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


       reply	other threads:[~2014-09-08 14:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAHAq8pF=hB4sfx+Fe6nfnbJ8W7E9r9e_mHytBdu=Oy_6CWukJA@mail.gmail.com>
2014-09-08 14:10 ` Peter Stephenson [this message]
2014-09-08 14:24   ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140908151037.5ec31e8a@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).