Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 Message-ID: <3EF553B3.68EAF8FA@dessent.net> Date: Sat, 21 Jun 2003 23:58:59 -0700 From: Brian Dessent Organization: My own little world... X-Accept-Language: en,pdf MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: stderr outputs veerrrryyy slowly References: <3EF099C8 DOT 8FDEC855 AT dessent DOT net> <3EF09ED6 DOT F4943C46 AT dessent DOT net> <3EF0B792 DOT 40204 AT cygwin DOT com> <3EF0BFA2 DOT 99CCC92A AT dessent DOT net> <3EF26B27 DOT 1020203 AT cygwin DOT com> <20030620021155 DOT GA19483 AT redhat DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Christopher Faylor wrote: > This crops up on the cygwin list from time to time. > > IIRC, if you use 'setbuf(f, NULL)' in newlib (as is the case for > stderr), it causes newlib to flush on every character. I submitted a > patch to fix this behavior many years ago but it was rejected. I think > the rationale was basically a "This isn't broken. We're allowed to do > this" but I don't really recall exactly why the patch was rejected. Hmmm. Well, I managed to come up with this minimal testcase: #include int main(int argc, char **argv) { char *msg = "This is a test! ", *ptr; int i; for(i = 0; i < 100; i++) { for(ptr = msg; *ptr; ptr++) { fputc(*ptr, stderr); } } } Running the above with CYGWIN=tty real 0m15.806s user 0m0.030s sys 0m0.010s Without CYGWIN=tty real 0m0.078s user 0m0.030s sys 0m0.020s Should it really take almost 16 seconds to print 1600 characters to stderr? Furthermore, if you change 'stderr' to 'stdout' above, the problem no longer happens, regardless of the setting of tty in $CYGWIN. So it's specific to stderr. Can anyone make heads (or tails) of this now? 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/