Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Single-run while makes script fast
- X-seq: zsh-workers 37308
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: Single-run while makes script fast
- Date: Fri, 4 Dec 2015 18:33:44 +0100
- 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:content-transfer-encoding; bh=QD9glxBMqou2inqJFUVVfmPp0MEEfAPeUEpuTXP2oN8=; b=o5ctkoHFWEC5Ls6sebFqUlE3ZNArR74/6UVMZ1w9SToHLhHZKD9yPwlsC2eVaL+tyT XrXPUrnOuRBq22jbgWTaM4V4na3IJn2RJaYjIu2qN0UFg2XQ/YURLsTGH8kWWMqCvSZ3 2BhsA1qez7nx6zq7MZYBRr+oM5+Hg5nlO11mQ8T0j/Mm6Z46eiI+ezFiCir+aCY0fPtq KcCRM4rNlCIVzJxE3IKCei2WNVyqQVKUAUAG/ZMoDKUeHj1APXOmyxmm9/cnMw52IvSO bgdgoIoaCAw6KrxG1tkJAHsixtpPKGcakqQ+TKN76fOkxMkGk9U5BZLnKavWo2hqt+9o 7eoQ==
- In-reply-to: <CAKc7PVAoYEZCJvpw-CF5=cbiZSeg3uO8FaJD2Ee6CkL71R+h4Q@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: <CAKc7PVAoYEZCJvpw-CF5=cbiZSeg3uO8FaJD2Ee6CkL71R+h4Q@mail.gmail.com>
I tested this on my two other scripts and it's speeding things up also
there. Already commited the "optimizations":
https://github.com/psprint/zsh-navigation-tools/commit/71fe5a2227a4e8a116878194bf2bbb6db1bb8c25
Best regards,
Sebastian Gniazdowski
On 4 December 2015 at 17:20, Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
> Hello,
> I attach animated gif showing the effect. The while loop in following
> code makes whole script fast:
>
> loop=1
> while (( loop -- )); do
> filename="lsoflsof" # 89k elements
> body=( "${(@f)"$(<"$filename" )"}" )
> done
>
> Commenting out the loop and leaving only its body makes the whole script slow:
>
> loop=1
> #while (( loop -- )); do
> filename="lsoflsof" # 89k elements
> body=( "${(@f)"$(<"$filename" )"}" )
> #done
>
> This is reveals on Zsh 5.0.8 (OS X). On 5.2 it isn't visible or
> doesn't actually occur – because of recent optimizations.
>
> I wasn't able to reproduce this in some short script, but might yet
> try to do this. I'm reporting because maybe there is something hidden
> behind this.
>
> Best regards,
> Sebastian Gniazdowski
Messages sorted by:
Reverse Date,
Date,
Thread,
Author