Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Single-run while makes script fast



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