Subject: Runtime speed with GNU compilers
From: [email-masked] ("Stefano Gragnani")

13 Apr 1997 07:20:11 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Original-To: <[email-masked]>
X-MSMail-Priority: Normal
X-Priority: 3
X-Mailer: Microsoft Internet Mail 4.70.1155
Original-Sender: [email-masked]

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
"[email-masked]" with one line of text: "help".