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

Re: Announce of Zsh Navigation Tools



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



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