Subject: gcc 3.1 slower than 2.95?
From: Marcus Elderic Koenig <[email-masked]>
To: [email-masked]
Date: Mon, 17 Jun 2002 12:58:45 +0000 (UTC)
Newsgroups: gmane.os.cygwin

now I compiled gcc 3.1 and tested it and I got confused again :)

everywhere I read 3.1 being about 30% faster than 2.95, but my tests 
show the exact opposite.

I did compile with:

./configure --enable-threads=win32
make bootstrap
make install

and I did set the library_path to the correct paths.

now when I compile the following source with gcc3 (previously compiled 
with gcc 2.95), I get the following results:

------------------------------------------------------------------------

// STL includes
#include <iostream>
#include <set>
#include <ctime>
#include "benchmark.h"

// namespaces to use
using namespace std;

int main() {

	set<float> storage;
	headroom__base::benchmark bench;
		
	bench.start();
	
	int i;
		
	cout << "inserting... " << endl;
						
	for (i = 0; i < 500000; i++) {
			
		storage.insert(i);
		storage.insert(3.14);			
			
	};

	cout << "insert ready." << endl
	     << "inserted floats: "
           << storage.size() << endl << endl
           << "referencing... " << endl;
			 
	set<float>::const_iterator setPos;
		
	for (i = 0; i < 500000; i++) {
		
		setPos = storage.find(i);
					
	};

	cout << "referencing ready." << endl << endl;
	
	cout << "in one second, I do "
           << CLOCKS_PER_SEC << " ticks." << endl
	     << "all this took me " << clock() << " ticks and "
	     << bench.stop() << " seconds." << endl;
			
    	return 0;

};

------------------------------------------------------------------------

-> gcc 2.95 
g++ -O2 -mcpu=pentium -Wall settest.cpp -lwinmm

-> gcc 3.1
g++ -O3 -mcpu=pentium -Wall settest.cpp -lwinmm

results:

C:\elderic\source\compiler speedtest>"gcc 2.95.exe"
inserting...
insert ready.
inserted floats: 500001

referencing...
referencing ready.

in one second, I do 1000 ticks.
all this took me 1902 ticks and 1.852 seconds.

C:\elderic\source\compiler speedtest>gcc3
inserting...
insert ready.
inserted floats: 500001

referencing...
referencing ready.

in one second, I do 1000 ticks.
all this took me 3594 ticks and 3.665 seconds.

----------------------------------------------------------------

this is not 30% faster, but about 70% slower????????????

can someone please tell me why this happens???

-elderic

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/