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

Single-run while makes script fast



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

Attachment: while.gif
Description: GIF image



Messages sorted by: Reverse Date, Date, Thread, Author