On Sun, Jun 27, 2004 at 03:42:05PM -0400, Christopher Faylor wrote: > On Sat, Jun 26, 2004 at 01:41:45PM -0400, Pierre A. Humblet wrote:
> >Digging deeper, I see there is a function getc_unlocked. Using it > >instead of getc improves the speed by a factor 5. > >Now that I know about it, I will redefine getc to getc_unlocked when > >porting single threaded applications. > > > >That issue may be a factor in the legendary slowness of Cygwin. > > FWIW, I added some code to this particular locking function to avoid > doing any locks if there is only one thread. I'm generating a snapshot > now. It will be interesting to see if it improves things. I didn't > do any benchmarking. I just verified that it worked the way I thought > it should by looking at strace output. Here it is, using a slightly modified version of Joseph's program http://cygwin.com/ml/cygwin/2004-06/msg00877.html Your change makes getc work almost as fast a getc_unlocked. This is on Win98. Yesterday's results were on WinME, where the differences were larger. That hard drive died this morning :( CYGWIN_98-4.10 Worldnet 1.5.10(0.116/4/2) 2004-05-25 22:07 i586 unknown unknown Cygwin W:~: time a.exe daqsystem.pdf 1 (read) real 0m0.282s W:~: time a.exe daqsystem.pdf 2 (getc_unlocked) real 0m1.295s W:~: time a.exe daqsystem.pdf 3 (getc) real 0m3.188s CYGWIN_98-4.10 Worldnet 1.5.11s(0.116/4/2) 20040627 15:47:35 i586 unknown unknown Cygwin W:~: time a.exe daqsystem.pdf 1 (read) real 0m0.275s W:~: time a.exe daqsystem.pdf 2 (getc_unlocked) real 0m1.294s W:~: time a.exe daqsystem.pdf 3 (getc) real 0m1.343s Pierre -- 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/