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

Re: mapfile module - avoiding $(...) in completion functions



"Andrej Borsenkow" wrote:
> May be it was discussed already, but is not mapfile module alternative to
> $(...)? We mostly need it to parse files content, as in
> $(</etc/printcap), and in this case we could just as well mmap the file.

There's no real efficiency issue here --- $(<...) is handled without
forking, just by reading the file in, so while mapping may in principal be
quicker the gain is certainly negligible.

mapfile is supposed to do this, too, if it doesn't find enough memory
management tools, so it should be safe to use anyway.  However, it's not a
particularly good idea to keep requiring extra modules for completion to
work:  completion is a basic feature, and the modules are supposed to be
optional to avoid the overhead.  This is even worse, for obvious reasons,
if the shell is statically linked.

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>



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