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

Re: [PATCH] ulimit option completions using ulimit -a output



Stephane Chazelas wrote:
> By the way, should I cache that list of options retrieved from
> the output of "ulimit -a"? After all, it's not going to change

I wouldn't bother. It's a shell builtin, everything it outputs is
straight from memory so the only cost is a single fork. No delay is
discernable.

> from one run to the next. But then again, a $(ulimit -a) command
> substitution is going to be fast and caching uses up memory. Do
> you have recommendations as to when to cache and when not to?

Mostly it comes down to what seems sensible in a particular case. The
main criteria being if a delay is noticable. But it would also depend
whether it is the type of command that is likely used repeatedly in a
session (which ulimit probably isn't much). There's also the choice
of just cache in a variable in memory vs. using the cache functions
to store it in a file. I'm more inclined towards that when it is very
large.

Oliver




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