pkgsrc-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: pkg_alternatives, Darwin and locale
Joerg Sonnenberger wrote:
> On Sun, Jul 20, 2008 at 04:26:47AM +0200, Christian Biere wrote:
> > +cat "${userfile}" __CONF_FILE__ __DB_FILE__ 2>/dev/null | \
> > +{
> > + while read line
> > + do
> > + line="${line##\#*}"
> > + prog="${line%%\ *}"
> > + if [ X != "X${prog}" ] && [ -x "${prog}" ]
> > + then exec ${line} "${@}"
> > + fi
> > + done
>
> Can you make this awk please? read is horrible slow for larger files...
Do these files list more than some dozen lines at most?
While I do know that 'read' is rather slow due to single byte reads,
NetBSD's /bin/sh is exceptionally S-L-O-W and for some reason also burns
a lot of more system time than other shells at this. ksh takes only a
third of the time.
I tried the following with a file of about 400k lines, actually the
output of "find /", redirecting standard out to /dev/null:
while read line
do
echo "$line"
done
I tested this with 3 shells repeatedly and got these results:
sh: 30 seconds (20 seconds system time)
bash: 18 seconds (2 seconds system time)
ksh: 9 seconds (less than 2 seconds system time)
Replacing "echo $line" with ":" gains only 3 seconds for sh and doesn't
change the rankings.
--
Christian
Home |
Main Index |
Thread Index |
Old Index