delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/09/05/07:58:30

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
From: egb AT us DOT ibm DOT com
X-Lotus-FromDomain: IBMUS
To: "Jonas Jensen" <bones0_list AT hotmail DOT com>
cc: "Cygwin List" <cygwin AT sources DOT redhat DOT com>
Message-ID: <85256951.00419DE9.00@d54mta04.raleigh.ibm.com>
Date: Tue, 5 Sep 2000 07:56:32 -0400
Subject: Re: printf is faster when piped through tee
Mime-Version: 1.0


In past Unix systems the reason for the performance change you see was
because the stdio library detects a non-tty output
stream and buffers. Than means that instead of doing 100 system calls you
would only do one. Try putting a flushb() in after
the printf. If the performane of all three degrade to roughly equivalient
then stdio buffering is the culprit

Ed Bradford

Your Windows 2000 Arborist
T/L 589-4410; Outside: 1-919-993-4410
egb AT us DOT ibm DOT com


"Jonas Jensen" <bones0_list AT hotmail DOT com>@sources.redhat.com on 09/02/2000
10:11:08 AM

Sent by:  cygwin-owner AT sources DOT redhat DOT com


To:   "Cygwin List" <cygwin AT sources DOT redhat DOT com>
cc:
Subject:  printf is faster when piped through tee



Something's wrong with the performance of printf. When compiling with gcc,
printf executes much slower than with Microsoft's "cl". The funny thing is
that when I pipe those programs through "tee", they're both (equally) fast.

This is my test program:
------------------------------------------------
#include <stdio.h>
#include <stdlib.h>

void main(int argc, char** argv)
{
   register int i;
   if (argc != 2) return 1;
   i = atoi(argv[1]);
   while (i--)
      printf("%i bottles of beer on the wall...\n", i);
}
------------------------------------------------

Here are the scores of 1000 loops through this program, in seconds,
measured
with the "time" keyword in bash.

cl: 0.561
gcc: 10.055
gcc/tee: 0.861
cl/tee 0.861

It appears that there's a way to print faster, because "cat" has no
problem,
while "ls" and others suffer badly from it.
Can anyone explain/fix this?

I'm using Win2k, Cygwin 1.1.4.

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com





--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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