Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Shell startup, aliases vs. functions vs. autoloadable functions, and zcompile benefits
- X-seq: zsh-users 27393
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zach Riggle <zachriggle@xxxxxxxxx>
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Shell startup, aliases vs. functions vs. autoloadable functions, and zcompile benefits
- Date: Mon, 29 Nov 2021 20:11:45 -0800
- Archived-at: <https://zsh.org/users/27393>
- In-reply-to: <CAMP9c5=nQS_cw19fuKhKMJAAVPwEr5oCNUiBDBCWBiPC1KioWw@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <CAMP9c5=AkW8B0byaw9J-_rVJ0B19q9xx3wjz3MAgJr6uCF6vNQ@mail.gmail.com> <CAN=4vMpyybbN-DTT7eAXdxV_a=CtaEcaNTKEszQjgL8urTY_zg@mail.gmail.com> <CAH+w=7ZuG0z7m5_z8qCaGiCpDO0KRvXHWz3jkighvkaFcd6+LA@mail.gmail.com> <CAMP9c5=nQS_cw19fuKhKMJAAVPwEr5oCNUiBDBCWBiPC1KioWw@mail.gmail.com>
On Mon, Nov 29, 2021 at 6:30 PM Zach Riggle <zachriggle@xxxxxxxxx> wrote:
>
> I would expect that the md5sum of a file is reasonably fast, and could be stored in the .zwc for sanity checking, instead of just the "newer than" check.
To what are you comparing that checksum? It could tell you if the
.zwc file were corrupted, but not whether the file differs from all
the component files that were compiled into it. Even if you could
somehow tell they were different, that doesn't answer the question of
whether the .zwc contains newer versions of any of those functions.
The .zwc does contain a check that it matches the parser version of
the shell that's trying to read it.
> I expect that I have more $fpath entries than usual, but the total number of autoloadable functions is much more.
That's exactly the point: You're unlikely to ever execute most of
those functions, so storing an autoload entry for them is much more
space-efficient (and startup-time faster) than actually parsing and
storing the function definitions themselves.
> $ for d in $fpath; do n=$(ls $d/* | wc -l); echo "$n $d"; done | sort -nr | head -3
Good heavens, so many processes and pipes.
n=($^fpath(e^'n=($REPLY/*(N.)); reply=("$#n $REPLY")'^))
print -l ${${(On)n}[1,3]}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author