zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: One more heap optimization trick for zsh < 5.2
Date: Fri, 10 Jun 2016 20:30:56 -0700	[thread overview]
Message-ID: <160610203056.ZM10515@torch.brasslantern.com> (raw)
In-Reply-To: <CAKc7PVDaLHs3xEVJGFn1F2M0BEEOzZFt8enMis7tTmbVKLx12Q@mail.gmail.com>

On May 16,  5:01pm, Sebastian Gniazdowski wrote:
} Subject: Re: One more heap optimization trick for zsh < 5.2
}
} I was testing the same input with 89k lines. The cause now
} accidentally clarified. It's about zplugin's shadowing of autoload

I was writing this off until I noticed that it's not just that the
first n-list takes a long time to begin, but that every motion in
the zcurses display takes a long time to update the viewport.

This means that it has to be something that's happening in the loop
inside the n-list function, affecting every iteration.

Consequently it must be one of n-list-input or n-list-draw, both of
which are declared with [the shadowed] autoload inside n-list itself.
Something about nesting calls to --zplg-reload-and-run is causing
the issue.  It might have something to do with retaining the old copy
of the function body until the call stack unwinds and it can safely
be freed; a large value for $argv would therefore also hang around
(two copies of it) for all of that time.

Incidentally, the way n-list is currently written, it will re-autoload
those functions and re-create all the _nlist_* helpers EVERY TIME IT
IS RUN.  Mostly that's all of no net effect, but it must be slowing
down each call to n-list at least a little bit.

Anyway, once n-list has run at least once, n-list-draw and n-list-input
are fully defined without --zplg-reload-and-run, so the slowdown during
the loop goes away.  I still don't know exactly *why* this would make
any difference, but a zprof pass *might* reveal something useful.


  parent reply	other threads:[~2016-06-11  3:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-08  9:34 Sebastian Gniazdowski
2016-05-08 16:35 ` Bart Schaefer
2016-05-16 15:01   ` Sebastian Gniazdowski
2016-05-17 10:18     ` Bart Schaefer
2016-05-18 15:16       ` Sebastian Gniazdowski
2016-06-11  3:30     ` Bart Schaefer [this message]
2016-06-11  7:40       ` Sebastian Gniazdowski
2016-06-11  8:07         ` Sebastian Gniazdowski
2016-06-12 15:39         ` Bart Schaefer

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=160610203056.ZM10515@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@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).