zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: Why approximate pattern doesn't match?
Date: Tue, 10 May 2016 11:12:36 -0700	[thread overview]
Message-ID: <160510111236.ZM1388@torch.brasslantern.com> (raw)
In-Reply-To: <CAKc7PVBHuo8Hqu3fs_kLfW-hPG58DrVhZgPE24s3zHq09ndH6g@mail.gmail.com>

On May 10,  7:29pm, Sebastian Gniazdowski wrote:
}
} What's interesting is that this (doing ${a//(#a1)a|(#a1)b|...}) is
} painfully slow when compared to *~^* and :#, it works slower for 25
} elements than :# works for 5000.

As Mikael pointed out, ~^ is "and", whereas | is "or" -- for the "or"
case you have to compare every possibility to every array element, but
for the "and" case you can rapidly discard elements that don't match
the initial pattern.  It's not quite O(n*m) vs. O(n) but is in that
ballpark.


  reply	other threads:[~2016-05-10 18:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-09 20:07 Sebastian Gniazdowski
2016-05-09 20:11 ` Sebastian Gniazdowski
2016-05-10  3:56   ` Bart Schaefer
2016-05-10  5:16     ` Sebastian Gniazdowski
2016-05-10 15:05       ` Peter Stephenson
2016-05-10 15:21         ` Sebastian Gniazdowski
2016-05-10 15:40           ` Peter Stephenson
2016-05-10 17:16             ` Sebastian Gniazdowski
2016-05-10 17:29               ` Sebastian Gniazdowski
2016-05-10 18:12                 ` Bart Schaefer [this message]
2016-05-10 16:42     ` Mikael Magnusson

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=160510111236.ZM1388@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@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).