zsh-workers
 help / color / mirror / code / Atom feed
* Single-run while makes script fast
@ 2015-12-04 16:20 Sebastian Gniazdowski
  2015-12-04 17:33 ` Sebastian Gniazdowski
  2015-12-04 17:43 ` Bart Schaefer
  0 siblings, 2 replies; 5+ messages in thread
From: Sebastian Gniazdowski @ 2015-12-04 16:20 UTC (permalink / raw)
  To: Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 764 bytes --]

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 #2: while.gif --]
[-- Type: image/gif, Size: 226679 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-12-04 18:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-04 16:20 Single-run while makes script fast Sebastian Gniazdowski
2015-12-04 17:33 ` Sebastian Gniazdowski
2015-12-04 17:43 ` Bart Schaefer
2015-12-04 18:01   ` Peter Stephenson
2015-12-04 18:27   ` Sebastian Gniazdowski

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).