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

Re: Single-run while makes script fast



On Dec 4,  5:20pm, Sebastian Gniazdowski wrote:
} 
} I attach animated gif showing the effect. The while loop in following
} code makes whole script fast:

By code examination rather than actual experiment --

The difference when the while-loop is introduced is that the entire
heap allocated by body=(...) is discarded with a single popheap() at
the "done", whereas without the loop the space is reclaimed by a call
to freeheap() which has to examine every heap arena.

You should be able to get the same effect with "repeat 1" so as not
to need the loop-counter variable.

This might indicate that the exec*() routines in Src/loop.c are not
doing as much as they could to keep memory footprint to its minimum.



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