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

Re: Slow completion

On Mar 8, 10:45am, joe M wrote:
} I am wondering if there would be any benefit in compiling the
} completion functions such as _main_complete, etc. Will that show a
} performance boost?

Nobody answered this, I guess.  The answer is complicated.

Although .zwc requires less parsing/interpretation than plain text, it's
often larger on disk because of storing both the bytecode and the raw
strings for xtrace.  On the other hand it doesn't include comments, so
heavily-commented functions might come out smaller.

It is probably not a win to compile all the functions into a single .zwc
file because most people don't use anywhere near the entire suite, so
you'll be loading a bunch of stuff you don't need.  The flip side of
this is that zsh is usually able to memory-map the whole .zwc file,
which is probably faster than reading individual small files, so it may
be a wash.

Whether there's a benefit to selectively compiling the parts that you do
use is system-dependent, and again is related to the file sizes.  If you
have fast disk I/O it may be a win (when zcompile was invented I/O was
consistently faster than parsing) but on say a laptop that does not have
SSD you may be better off parsing on the fly.

The best I can offer is, try it both ways and compare.

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