Massive performance difference in applications built with/without -mno-cygwin

Andy Rushton ajr1@ecs.soton.ac.uk
Thu Apr 29 11:42:00 GMT 2004


Following up from the postings recently on program performance using 
different compilers, I've been doing some experiments of my own using 
just the gcc provided with Cygwin. I have a lot of code that can build 
as Cygwin executables (i.e. gcc without -mno-cygwin) and Cyg*ming* 
executables (i.e. gcc with -mno-cygwin). I use exactly the same compiler 
with the same optimisation settings. I'm getting huge performance 
differences - from 2x to 20x slow down for the Cygwin version over the 
Cygming one.

gcc -v gives:

Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/specs
Configured with: /GCC/gcc-3.3.1-3/configure --with-gcc --with-gnu-ld 
--with-gnu-as --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc 
--libdir=/usr/lib --libexecdir=/usr/sbin --mandir=/usr/share/man 
--infodir=/usr/share/info 
--enable-languages=c,ada,c++,f77,pascal,java,objc --enable-libgcj 
--enable-threads=posix --with-system-zlib --enable-nls 
--without-included-gettext --enable-interpreter --enable-sjlj-exceptions 
--disable-version-specific-runtime-libs --enable-shared 
--disable-win32-registry --enable-java-gc=boehm 
--disable-hash-synchronization --verbose --target=i686-pc-cygwin 
--host=i686-pc-cygwin --build=i686-pc-cygwin
Thread model: posix
gcc version 3.3.1 (cygming special)

gcc -mno-cygwin -v gives:

Reading specs from /usr/lib/gcc-lib/i686-pc-mingw32/3.3.1/specs
Configured with: /GCC/gcc-3.3.1-3/configure --with-gcc --with-gnu-ld 
--with-gnu-as --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc 
--libdir=/usr/lib --libexecdir=/usr/sbin --mandir=/usr/share/man 
--infodir=/usr/share/info 
--enable-languages=c,ada,c++,f77,pascal,java,objc --enable-libgcj 
--enable-threads=posix --with-system-zlib --enable-nls 
--without-included-gettext --enable-interpreter --enable-sjlj-exceptions 
--disable-version-specific-runtime-libs --enable-shared 
--disable-win32-registry --enable-java-gc=boehm 
--disable-hash-synchronization --verbose --target=i686-pc-cygwin 
--host=i686-pc-cygwin --build=i686-pc-cygwin
Thread model: posix
gcc version 3.3.1 (cygming special)

Does anyone have an explanation?

Example:
======

I've been developing a platform- and compiler-independent 
infinite-precision integer class (I've been forced into not using GMP 
for political reasons - other people's politics that is - don't ask).

I have a simple testbench that throws a lot of random numbers at the 
class and verifies the correctness of the calculations. I'm using 
std::string as a dynamic byte array as my basic storage. Thus, just 
about everything is being done in memory, so I guess the majority of 
system calls are to do with memory allocation/deallocation.

I build using the following options:

gcc -c -I. -ftemplate-depth-50 -funsigned-char -DNDEBUG -Wall 
-fno-for-scope -O3 

In Cygming mode I just add -mno-cygwin to this set, there are no other 
changes.

Here's the CPU and elapsed time provided by the clock() and time() 
functions and is calculated as the difference between the values at the 
start of main and the end of main (so any startup before main is not 
counted).

Cygwin: 62.61s CPU, 1:03 elapsed
Cygming: 3.06s CPU, 3s elapsed

If anyone is interested in reproducing this behaviour, I've attached a 
script (run-test) that will download source code (its all open-source), 
build the test programs and run the tests.

Obviously you should read the script first to satisfy yourself there's 
nothing nasty in there!

Andy

-- 
Andy Rushton, Southampton, UK

SYSTEM-INDEPENDENT:
	Works equally poorly on all systems.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygcheck.out
URL: <http://cygwin.com/pipermail/cygwin/attachments/20040429/6a612896/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: run-test
URL: <http://cygwin.com/pipermail/cygwin/attachments/20040429/6a612896/attachment-0001.ksh>
-------------- next part --------------
--
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/


More information about the Cygwin mailing list