Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Substitution ${...///} slows down when certain UTF character occurs
- X-seq: zsh-workers 36733
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Substitution ${...///} slows down when certain UTF character occurs
- Date: Thu, 1 Oct 2015 15:45:17 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=p/jYzq2OjFEWv+5adShcbcwqKsKaxeUMxo8ttCVbvCI=; b=mSke7Gg2mUkpVQBeqo0pXnDyomuuoRgz4iSFnSBdY+kuvBXyx0zzSg6N3MVIKkEeB4 Tvkecj7Oe1zrfD5nEqIm3Ri5SuQ/+BI4/t4GWmZ3SqATyOs3HdEryO+8A8R2EKkzl4vq 7pnsdw85XZVULgFexp4wkhKd8cb522jqn8lMXudKo0Pjqssacqf3UZTwV6/pNVrpW61Q ZwxqYAzeCGbLx6GFUCJxBE4/vEU488QmYVX8z6oi3KzwVdMXcnuF3mRE0CWSwHMcpXnY q8qE8pVgo8Ie0AWIFqDknzF2I/Pm6Px7vTn7Dw+FSyRN62HqZV0YvNrJSssmpi8fs3Ho BsUQ==
- In-reply-to: <150927091121.ZM25721@torch.brasslantern.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: <CAKc7PVBuCuLux8WhBORuYo_vQUQ18OP-XMQXWdYkL84pFLt+LQ@mail.gmail.com> <150926134410.ZM17546@torch.brasslantern.com> <CAKc7PVC_12=vVfCKGhxd9L06=+o0-r7Zti+Ag1xnv8C4tEwvmQ@mail.gmail.com> <150927091121.ZM25721@torch.brasslantern.com>
On 27 September 2015 at 18:11, Bart Schaefer
> It'll get worse if there are partial matches, e.g., if you had 30000
> repetitions of "wfei" and scanned for "wfeiwj" there'd be a whole lot
> of backtracking. There are no "w" anywhere in your sample $str so
> each of the comparisons is only one equality test.
It's still instant fast for 30k of wfei (attached is the script). I
also tried generating a [wfeiwj]-only string, and it's also fast:
cat /dev/urandom | env LC_CTYPE=C tr -cd 'wfeiwj' | head -c 120000 > input
Gave it one more try with
"wfeiwjwoiejfowiejfowijefoiwjefoiwjefoijwoeifjwoiejf" (30k of it, and
was searching for it) and it becomes slower (times 0.15s instead of
0.012s) but is still instant fast.
>
> Still I think the biggest issue is that unmetafication happening too
> low down. Since pattry*() is being called repeatedly with the same two
> first arguments (prog and string) it might be possible to cache the
> unmetafied string after the first call.
I wonder why it depends on Zsh version and/or environment (OS, etc.).
This doesn't seem related to unmetafication, unless it was changed
after 5.0.2.
Best regards,
Sebastian Gniazdowski
Attachment:
test-script.zsh
Description: Binary data
Messages sorted by:
Reverse Date,
Date,
Thread,
Author