Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Performance numbers on "if [" vs. "[" alone vs. "if [[" vs. "[[" alone
- X-seq: zsh-users 21935
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Performance numbers on "if [" vs. "[" alone vs. "if [[" vs. "[[" alone
- Date: Sat, 17 Sep 2016 09:39:19 +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; bh=GKYOE3gJSnZGiKuLJ/CELTw7uB3jzC0bIyADMaj/xYs=; b=qKgufS3KHtq8zTD8NQtMr0t513YJIrG08O92N5R+nljVTF+Oyc9rorbUreZ8600oQk 1xgl0kP+U+PusQ3eut0DmaGSiH4lAh3NaD+W5w2J6+biyKY40bfBhiYDyAbuiptJ3KzA BThT2+3a6LbK8mI92UBFi2LJKI1qDHQwBbYDhn0kdLAg3Fw4dZKSMf7+DXcTt6aYzSKQ 4MVhaic8XvBKbv5QFrjgaJXjqgXEH/WrCyKipUmlh1TAuewOp3iHnCXYlLM3LNmERsE1 drXSMc980hia02ELGAVCLPnt7zPPiAFUuj+5Qy2WIPbjZ/kFNxNy08OvWFXO022bZp94 z+XA==
- In-reply-to: <CAKc7PVD1bo+k-yfEuLEwYSZUkg6S1xpMu-eKci0mztyv97KPsg@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVBEe=Wz=OL+T=ZqHn2ivra1=XFmToprzMESGezmzy2dbw@mail.gmail.com> <CAKc7PVD1bo+k-yfEuLEwYSZUkg6S1xpMu-eKci0mztyv97KPsg@mail.gmail.com>
PS. To show how futile using [[ instead of if [[ might be, I have an
optimization that I once did:
https://github.com/psprint/zsh-navigation-tools/commit/4a064efb04a3903ceb227df24f5ef2bb3533781e
It gave 60 ms, that gain was stable otherwise I wouldn't commit it
(zprof's results didn't seem to get disturbed randomly), however,
_nlist_expand_tabs was called as much as 30000 times.
Best regards,
Sebastian Gniazdowski
On 16 September 2016 at 12:18, Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
> I've replaced near all if [[ ]] calls with [[ ]] in
> zsh-syntax-highlighting's main-highlighter.zsh, and no performance was
> gained. So unless there's a tight loop, if [[ doesn't slow down when
> compared to [[ alone.
>
>
> BTW. Running attached parse.zsh on toparse.zsh with zsh-5.2 in shebang
> produces following difference in generated region_highlight, to
> /bin/zsh (OS X 5.0.8):
>
> 439c439
> < 3878 3885 fg=yellow
> ---
>> 3878 3885 fg=green
>
> The same difference for 5.1.1, 5.1. Zsh-5.0.8-dev-0 doesn't produce
> the difference, and 5.0.8-dev-1 produces it, so apparently that's
> where the difference starts appearing, compared to OS X 5.0.8
> /bin/zsh.
>
> Best regards,
> Sebastian Gniazdowski
Messages sorted by:
Reverse Date,
Date,
Thread,
Author