From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26835 invoked by alias); 5 Mar 2012 00:37:28 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16836 Received: (qmail 27379 invoked from network); 5 Mar 2012 00:37:17 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <120304134721.ZM25119@torch.brasslantern.com> Date: Sun, 04 Mar 2012 13:47:21 -0800 In-reply-to: Comments: In reply to Mikael Magnusson "Re: if the file is not found the files is not found is the file not found" (Mar 4, 9:13pm) References: <20120304143102.GE18164@solfire> <120304103757.ZM24588@torch.brasslantern.com> <120304114412.ZM24769@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: if the file is not found the files is not found is the file not found MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Mar 4, 9:13pm, Mikael Magnusson wrote: } } >> if () { (( $# )) } arglblargh*(N[1]); then echo yes; else echo no; fi } > } > (Also, the [1] in your formula is extraneous, but that's a nit.) } } I like to imagine that it causes less data to be copied around. :) According to valgrind, for a pattern matching six files the ([1]) saves 3 mallocs and 3 frees but uses 346 *more* bytes of memory. "time" on 10 runs of each shows no difference at all. The ([1]) does begin to win on memory as well when the number of matched files grows, but even at 360+ files no difference in time is detectable, probably because the vast bulk is taken up by doing the glob in the first place. (e:'[ -f "$REPLY" ]':) takes about 3 times as long and uses 5 times as much memory, with or without ([1]) added. (e:'[[ -f "$REPLY" ]]') is better, only double time and triple memory, and is on a par with adding (.) as a qualifier. So there you go. :-)