Runtime speed with GNU compilers

Stefano Gragnani stefano@tirreno.it
Sun Apr 13 06:18:00 GMT 1997


I have downloaded and installed under Windows NT 4.0 the latest Cygnus
GNU-Win32 software. All work fine but the time of execution is very very
slow. For example:

#include <iostream.h>
#include <math.h>
#include <time.h>

void main(void)
{
	double y;

	clock_t time1, time2;
	time1 = clock() / CLOCKS_PER_SEC;


	for (double i = 1.0; i <= 100000000.0; i++)
		y = sin(i) / cos(i);
	
	time2 = clock() / CLOCKS_PER_SEC;
	cout << "y = " << y << " ==> Time = " << time2 - time1 << " seconds!" <<
endl;
 }

For this we obtain 2062 seconds !!! (My machine is a PentiumPro 200 MHz,
128 MB RAM)
With the same code if compiled with the old Borland c++ 4.0 we obtain 219
seconds and with cross-compilation (Metrowerks CodeWarrior 11 compiler
under PowerMacintosh) we obtain 125 seconds.

I have not experience with GNU compilers (is the first time I used it), I
have compiled and linked the file with the command:

g++ -o3 trigtest.cpp

If I well understood the '-o3' option optimize for speed.

If possible email me for delucidation.

Thanks
Stefano Gragnani

.... and sorry for my english!


-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list