From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: Announce of Zsh Navigation Tools
Date: Sat, 12 Sep 2015 16:03:53 -0700 [thread overview]
Message-ID: <55F4AF59.70606@eastlink.ca> (raw)
In-Reply-To: <150912151040.ZM12254@torch.brasslantern.com>
On 09/12/2015 03:10 PM, Bart Schaefer wrote:
> On Sep 12, 2:03pm, Ray Andrews wrote:
> }
> } What are the pros and cons of doing things that way vs. what might
> } seem to be the more obvious function definition? It's more compact,
> } but then requires the special calling via autoload. I expect there
> } will be some substantial difference.
>
> There isn't (intended to be) any execution-time difference. If you
> can find one, it's probably a bug, except for the variations that
> are implied by (misapplication of) the -z / -k options of autoload.
>
> The main benefit is that you don't have loaded into memory those
> functions that you don't use. The not-yet-loaded form of an autoloaded
> function is very small. You also avoid a lot of the startup time of
> parsing all those files. E.g., the completion system is now nearly
> 10MB; why read all of that when most of it may never be used?
>
> I suppose, conversely, the drawback is that there may be a delay for
> parsing, the first time any such function is executed.
>
> Another drawback is that you can't easily switch among different
> emulation modes without taking special precautions, because the parse
> will always be applied using the mode at the time of first execution
> rather than the mode when the autoload command was issued. We could
> probably stand an autoload option to apply "sticky emulation."
>
Ah ...
I load my own functions thusly:
for aa in /aWorking/Zsh/Source/*; do source $aa; done
... but as I understand you, autoload only 'really' loads things when
they are actually called, so that has to be more efficient. That
immediately makes me want do something like this:
for aa in /aWorking/Zsh/Source/*; do autoload $aa; done
... remembering of course that things need to be rewritten to look like
scripts. As to emulation, that's still way over my head.
BTW, looking at $fpath, it sure is laborious. Do we, could wehave some
sort of automatic subdirectory inclusion? Sorta:
/usr/share/zsh/functions/**/ ... or something like that?
next prev parent reply other threads:[~2015-09-12 23:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-08 12:32 Sebastian Gniazdowski
2015-09-12 17:50 ` Ray Andrews
2015-09-12 19:41 ` ZyX
2015-09-12 21:03 ` Ray Andrews
2015-09-12 22:10 ` Bart Schaefer
2015-09-12 23:03 ` Ray Andrews [this message]
2015-09-12 23:43 ` Bart Schaefer
2015-09-12 23:53 ` Bart Schaefer
2015-09-13 0:41 ` Ray Andrews
2015-09-13 2:36 ` Bart Schaefer
2015-09-13 3:33 ` Ray Andrews
2015-09-14 2:14 ` autoload Ray Andrews
2015-09-14 2:38 ` autoload Bart Schaefer
2015-09-14 3:34 ` autoload Ray Andrews
2015-09-14 20:21 ` autoload Bart Schaefer
2015-09-15 2:48 ` autoload Ray Andrews
2015-09-15 3:48 ` autoload Bart Schaefer
2015-09-15 16:18 ` autoload Ray Andrews
2015-09-16 4:09 ` autoload Ray Andrews
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=55F4AF59.70606@eastlink.ca \
--to=rayandrews@eastlink.ca \
--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).