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

Re: if the file is not found the files is not found is the file not found



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



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