zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Single-run while makes script fast
Date: Fri, 4 Dec 2015 09:43:31 -0800	[thread overview]
Message-ID: <151204094331.ZM16171@torch.brasslantern.com> (raw)
In-Reply-To: <CAKc7PVAoYEZCJvpw-CF5=cbiZSeg3uO8FaJD2Ee6CkL71R+h4Q@mail.gmail.com>

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.


  parent reply	other threads:[~2015-12-04 17:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-04 16:20 Sebastian Gniazdowski
2015-12-04 17:33 ` Sebastian Gniazdowski
2015-12-04 17:43 ` Bart Schaefer [this message]
2015-12-04 18:01   ` Peter Stephenson
2015-12-04 18:27   ` Sebastian Gniazdowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=151204094331.ZM16171@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).