Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Single-run while makes script fast
- X-seq: zsh-workers 37306
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Single-run while makes script fast
- Date: Fri, 4 Dec 2015 17:20:43 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=f+tokXNhLBFKYa64n08agn0gXya/vk2QgmqVlldU91k=; b=mUfStgvbwp1VERtfNt3EZi8FBd1MqmM7TWUvpURxsX7A8jKuXlThdr5W07ZyR3TfAP PmGfzrotp6gmV42077dGVLzcTTeWfQ7sT6wvbkFL2GDLo/wRmmElicN0TGaqK6QIbwO0 LUZ5OUUbNHMA6jsNTfYwXMfY+1buexTs9dAhsSwqL/CHLYlg2pfXvWx9Fsh/oWbt05Ap EWD/YU8T2ikzy/6l6fIvSxpMwwE17cRASYOIfgCQahVX8WUVZKn2ZRjBVtMYOv0d8N2y 3+r+5CHmF98e7Hhe2gHPAbng/whRABP96soa4qam9VN9Sao9T69TTA7h5IPNcyzqsFnZ rKSw==
- 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
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