X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 	tests=AWL,BAYES_00
X-Spam-Check-By: sourceware.org
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain; 	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Subject: RE: Simple bash script is slow to execute - appears to be time spent   starting commands like ls
Date: Wed, 2 Sep 2009 14:00:01 -0500
Message-ID: <786EBDA1AC46254B813E200779E7AD363AFE50@srv1163ex1.flightsafety.com>
In-Reply-To: <E1Miupq-0000A7-Kk@elasmtp-kukur.atl.sa.earthlink.net>
References: <4A9EB7E9.9030508@bopp.net> <E1Miupq-0000A7-Kk@elasmtp-kukur.atl.sa.earthlink.net>
From: "Thrall, Bryan" <bryan.thrall@flightsafety.com>
To: <cygwin@cygwin.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

David Tazartes wrote on Wednesday, September 02, 2009 1:46 PM:

> Jeremy Bopp wrote:
>=20
> How about we try to boil this down a little further?  Try running the
> following on your various systems and compare the results:
>=20
> time for n in $(seq 1 10000); do true; done
>=20
> I'm hopeful that this should help eliminate IO as a bottleneck in your
> comparisons.  Maybe someone else has a better suggestion.
>=20
> If you still see a difference in performance of a similar magnitude as
> you do with the echo | cut case, this might argue for fork being your
> problem.  I can't say whether or not what you're seeing is really
> expected for fork though.  All I know is that fork is fairly slow in
> Cygwin.  If it turns out that IO is the issue, I don't think I'll be
> much help, not that I'm much help to begin with here. ;-)
>=20
> It's also possible that you have BLODA on your laptop which could be
> interfering in some way.  I think cygcheck is able to identify some of
> them for you.  The problem reporting guidelines
> (http://cygwin.com/problems.html) contain information for running
> cygcheck which may help others identify typical problems.
>=20
> -----
>=20
> The true loop is only about 3 times slower on Cygwin than Linux. But:
"true"
> is a bash built-in, so there is no forking going on. So I'd argue this
> absolutely shows there is a forking problem. ("time true" and "time
echo hi"
> both give all 0's.)
>=20
> I also noticed that running "echo hi | c:\cygwin\bin\wc -l" just from
cmd
> seems to pause for a second or so. So perhaps I have just a problem
starting
> processes quickly in Vista.
>=20
> cygcheck didn't reveal anything. I looked at the BLODA list and I only
have
> Symantec Antivirus as mentioned earlier, but I already tried disabling
it to
> no effect.

You're right about true being built-in, but we still don't know from
your examples whether the problem is from forking or from IO. Try
replacing 'true' in Jeremy's loop with '/bin/true'. Comparison between
the two should give us an idea of the forking cost, without IO getting
in the way.

--=20
Bryan Thrall
FlightSafety International
bryan.thrall@flightsafety.com

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

