zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: if the file is not found the files is not found is the file not found
Date: Sun, 04 Mar 2012 13:47:21 -0800	[thread overview]
Message-ID: <120304134721.ZM25119@torch.brasslantern.com> (raw)
In-Reply-To: <CAHYJk3RsBwFCFLwdeQYJPygmRsYGQ9CxjvAF+YtnkE4PwxZfQQ@mail.gmail.com>

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. :-)


  reply	other threads:[~2012-03-05  0:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-04 14:31 meino.cramer
2012-03-04 14:36 ` Moritz Bunkus
2012-03-04 14:37 ` Mikael Magnusson
2012-03-04 18:37   ` Bart Schaefer
2012-03-04 18:48     ` Mikael Magnusson
2012-03-04 19:44       ` Bart Schaefer
2012-03-04 20:13         ` Mikael Magnusson
2012-03-04 21:47           ` Bart Schaefer [this message]
2012-03-05  0:48             ` Mikael Magnusson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=120304134721.ZM25119@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).