From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Single-run while makes script fast
Date: Fri, 4 Dec 2015 18:33:44 +0100 [thread overview]
Message-ID: <CAKc7PVAtvNR6n9CUeKN2XWBCF-RJ7QPt+BwpC8cX4ssxZhgugw@mail.gmail.com> (raw)
In-Reply-To: <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@gmail.com> 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
next prev parent reply other threads:[~2015-12-04 17:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-04 16:20 Sebastian Gniazdowski
2015-12-04 17:33 ` Sebastian Gniazdowski [this message]
2015-12-04 17:43 ` Bart Schaefer
2015-12-04 18:01 ` Peter Stephenson
2015-12-04 18:27 ` Sebastian Gniazdowski
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=CAKc7PVAtvNR6n9CUeKN2XWBCF-RJ7QPt+BwpC8cX4ssxZhgugw@mail.gmail.com \
--to=sgniazdowski@gmail.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).