www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/04/13/07:20:11

From: stefano AT tirreno DOT it ("Stefano Gragnani")
Subject: Runtime speed with GNU compilers
13 Apr 1997 07:20:11 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199704131328.PAA19715.cygnus.gnu-win32@mail.tirreno.it>
Mime-Version: 1.0
Original-To: <gnu-win32 AT cygnus DOT com>
X-MSMail-Priority: Normal
X-Priority: 3
X-Mailer: Microsoft Internet Mail 4.70.1155
Original-Sender: owner-gnu-win32 AT cygnus DOT com

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 AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019