X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=JN2zr781eRh0GSa9 JH5o3koTSKHEFEI6FhwxXq4jcXXjlAU+IA+P2dm9pwD55iK/WiburTs1plnklZgb XchNr10DhtgfoFvC6OF8jDcII5/lyWHTEAzLiidYZ1+jSQeXq6TPe79aB82RqarM JWPb40V2oGcAHVpC013ua62wvFM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=UGt84WK7uRf7eh46SyO7Pc +vGUI=; b=j5kv3KyIrKhCYW0RUnzszNTM3Lg/poTEZ2+lAWaA3mdhX+rewSEkpe tFmLiixk3ExlEAbih3d4TZ5ltL6H63AU3hLMPQvqK4N7CHxYCn++9BTrElXtK3PO hydO07RyK3VYWligzkLOnHTx3+qpkoCyFGokj5ZYokOXyp8zlqDmQ= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f170.google.com X-Received: by 10.180.37.76 with SMTP id w12mr3053154wij.0.1443000545964; Wed, 23 Sep 2015 02:29:05 -0700 (PDT) Subject: Re: Bash / cygwin process spawning (?) performance very slow To: cygwin AT cygwin DOT com References: <5602684A DOT 5090108 AT null DOT net> From: Marco Atzeri Message-ID: <560270DD.3090104@gmail.com> Date: Wed, 23 Sep 2015 11:29:01 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <5602684A.5090108@null.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes On 23/09/2015 10:52, litter AT null DOT net wrote: > Hi all, > > I noticed that doing simple loops in Bash takes unexpectedly long under Cygwin on a Windows XP 32 bit machine > (CYGWIN_NT-5.1 2.2.1(0.289/5/3) 2015-08-20 11:40 i686 Cygwin) > > I already followed the FAQ advice in trying to determine general causes, and made a 'shadow' copy of /etc/passwd as described. > My PATH does not contain references to network shares. > > Still quite normal commands take a long time e.g. > time cat some-file | while read i;do echo $i;/bin/true;done > > real 1m44.953s > user 0m9.599s > sys 1m36.865s > > for a file of 167 lines. Process Explorer showed a CPU load of 20% on bash.exe, which was almost completely Kernel time. > Is such high Kernel load normal? may be. forks are time consuming and your command is spending all the time in fork In addition, I suspect your Antivirus is further slowing down the things. > I know it's a bit like comparing apples to oranges, but I run the SAME command from the same disk, from within a Debian 7 486 Linux on VirtualBox (!) on the same machine, it gave > real 0m3.871s > user 0m0.160s > sys 0m3.292s > > So even running in emulator, real/user/sys time are about 30/60/30 times faster. That's quite shocking. > Is this performance to be expected? That would make it an obvious choice to switch to VirtualBox on this machine. I have much better results with my cygwin also with a much longer file $ wc -l cygcheck.out 5220 cygcheck.out $ time cat cygcheck.out | while read i;do grep text $i;done .. real 0m0.288s user 0m0.015s sys 0m0.262s $ time awk '{if ($1 ~ /text/) print $1}' cygcheck.out ... real 0m0.076s user 0m0.015s sys 0m0.046s > Thanks, > Paul for every job there is the right tool :-0 Regards Marco -- 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