From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: from authenticated user by zero.zsh.org with local id 1kicjG-000A1Q-6p; Fri, 27 Nov 2020 12:19:58 +0000 Received: from authenticated user by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1kiciq-0009ms-Nl; Fri, 27 Nov 2020 12:19:32 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.93.0.4) (envelope-from ) id 1kicip-0003A1-Ey for zsh-workers@zsh.org; Fri, 27 Nov 2020 13:19:31 +0100 In-reply-to: <20201127071357.kifmnsmf45f6vkw3@chazelas.org> From: Oliver Kiddle References: <20201123214942.hi2rx7n3jk25ucmd@chazelas.org> <74327-1606347813.918593@HxCz.NV4p.AwzH> <20201126201431.a6ym56gcagomyvzk@chazelas.org> <20201127071357.kifmnsmf45f6vkw3@chazelas.org> To: Zsh hackers list Subject: Re: [PATCH] ulimit option completions using ulimit -a output MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <12151.1606479571.1@hydra> Date: Fri, 27 Nov 2020 13:19:31 +0100 Message-ID: <12152-1606479571.438744@cBp9.JV-x.oecz> X-Seq: 47663 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: 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