delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/03/31/10:50:48

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <424C1D0B.67435A81@dessent.net>
Date: Thu, 31 Mar 2005 07:53:47 -0800
From: Brian Dessent <brian AT dessent DOT net>
Organization: My own little world...
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: bash backtick operator very slow
References: <MCENKDNFJIGGLCDONNNHIECHCJAA DOT nsymms AT redwar DOT us>
X-IsSubscribed: yes
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019