This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: bash backtick operator very slow
- From: Brian Dessent <brian at dessent dot net>
- To: cygwin at cygwin dot com
- Date: Thu, 31 Mar 2005 07:53:47 -0800
- Subject: Re: bash backtick operator very slow
- Organization: My own little world...
- References: <MCENKDNFJIGGLCDONNNHIECHCJAA.nsymms@redwar.us>
- Reply-to: cygwin at cygwin dot com
Neal Symms wrote:
> ~$ time hostname
> MY_HOSTNAME
> real 0m0.111s
> user 0m0.060s
> sys 0m0.040s
Here bash only has to spawn one subprocess, /bin/hostname.
> ~$ time echo hello
> hello
> real 0m0.000s
> user 0m0.000s
> sys 0m0.000s
Here bash doesn't have to spawn anything, because echo is a built-in
function.
> ~$ time echo `hostname`
> MY_HOSTNAME
> real 0m6.175s
> user 0m0.060s
> sys 0m0.050s
But here bash has to first fork a copy of a subshell, which itself then
forks and spawns /bin/hostname as in the first case. Of the three this
requires the most work.
> Bash version is 3.1-4
That's probably the version of the base-files package. The only
versions of bash packaged are 2.05b-{15,16,17}.
> The sh shell has the same behavior. I don't have ash, but
> I suppose I could try that one too...
sh is ash under Cygwin.
As a wild guess, I would say that you have an /etc/passwd containing a
huge number of entries (every domain user), as produced by "mkpasswd
-ld". Something about the extended procedure required to execute the
third sequence of commands requires that the whole file be scanned, and
that is what is taking so long. Try "mkpasswd -lc" to create a passwd
file containing only local accounts and the current domain user, if that
is what's happening.
Brian
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/