delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
From: | "Alex Vinokur" <alexvn AT bigfoot DOT com> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | C++ Compilers : Comparative Performance Testsuite |
Date: | Thu, 30 Oct 2003 16:33:07 +0200 |
Lines: | 159 |
Message-ID: | <bnr7f0$14rul1$1@ID-79865.news.uni-berlin.de> |
NNTP-Posting-Host: | pop09-2ras2-p63.barak.net.il (212.150.105.63) |
X-Trace: | news.uni-berlin.de 1067524386 38664865 212.150.105.63 (16 [79865]) |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Newsreader: | Microsoft Outlook Express 6.00.2800.1106 |
X-MimeOLE: | Produced By Microsoft MimeOLE V6.00.2800.1106 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
An algorithm which computes very long Fibonacci numbers http://groups.google.com/groups?selm=bnni5p%2412i47o%241%40ID-79865.news.uni-berlin.de was used as a performance testsuite to compare speed of the code produced by various compilers. =========================================================== Windows 2000 Professional Ver 5.0 Build 2195 Service Pack 2 Intel(R) Celeron(R) CPU 1.70 GHz GNU time 1.7 (Cygwin; to get the real time used) =========================================================== A. Real and processor time used to compute * Fibonacci[10000], * Fibonacci[25000], * Fibonacci[50000] has been measured. Here are summary results. |========================================================================| | | Opt | Fib-10000 | Fib-25000 | Fib-50000 | | Compiler | Lev |-------------|-------------|---------------| | | | Real : CPU | Real : CPU | Real : CPU | |========================================================================| | GNU gcc compiler | |------------------------------------------------------------------------| | g++ 3.3.1 (Cygwin) | No | 0.45 : 0.41 | 1.86 : 1.81 | 6.63 : 6.58 | | | O1 | 0.28 : 0.24 | 1.03 : 0.99 | 3.87 : 3.60 | | | O2 | 0.27 : 0.23 | 1.02 : 0.98 | 3.79 : 3.73 | | | O3 | 0.27 : 0.24 | 1.02 : 0.98 | 3.81 : 3.74 | | | | : | : | : | | g++ 3.3.1 (Cygwin) | No | 0.33 : 0.30 | 1.59 : 1.56 | 5.71 : 5.66 | | Mingw32 interface | O1 | 0.20 : 0.16 | 0.87 : 0.84 | 3.02 : 2.97 | | | O2 | 0.19 : 0.16 | 0.85 : 0.82 | 2.97 : 2.91 | | | O3 | 0.19 : 0.16 | 0.85 : 0.82 | 2.98 : 2.93 | | | | : | : | : | | gpp 3.2.1 (DJGPP) | No | 0.37 : 0.24 | 1.99 : 1.92 | 10.53 : 10.42 | | | O1 | 0.20 : 0.11 | 1.15 : 1.05 | 7.48 : 7.37 | | | O2 | 0.19 : 0.11 | 1.08 : 0.99 | 7.23 : 7.12 | | | O3 | 0.19 : 0.11 | 1.08 : 0.99 | 7.25 : 7.12 | | | | : | : | : | |------------------------------------------------------------------------| | Digital Mars C/C++ Compiler, STLport 4.5.3 | |------------------------------------------------------------------------| | Version 8.35n | - | 0.20 : 0.16 | 0.84 : 0.80 | 3.82 : 3.74 | |========================================================================| B. The names of DLL files on which the programs depend : * g++ 3.3.1 (Cygwin) ------------------ C:\cygwin\bin\cygwin1.dll C:\WINNT\System32\KERNEL32.dll C:\WINNT\System32\NTDLL.DLL * g++ 3.3.1 (Cygwin, Mingw32 interface) ------------------------------------- C:\WINNT\System32\msvcrt.dll C:\WINNT\System32\KERNEL32.dll C:\WINNT\System32\NTDLL.DLL * gpp 3.2.1 (DJGPP) ----------------- DJGPP doesn't support dynamic linking. * Digital Mars C/C++ 8.35n ------------------------ C:\WINNT\System32\KERNEL32.DLL C:\WINNT\System32\NTDLL.DLL C:\WINNT\System32\USER32.DLL C:\WINNT\System32\GDI32.DLL C. Notes. ----------------------------- Note-1. The main() program in http://groups.google.com/groups?selm=bnni5p%2412i47o%241%40ID-79865.news.uni-berlin.de was slightly changed to get the processor time used. // ------ Updated main() : BEGIN ------ #include <time.h> // Added int main (int argc, char **argv) { const string option (check (argc, argv)); if (option.empty()) { usage (argv); return 1; } const uint N = atoi (argv[2]); const clock_t clock_start = clock(); // Added assert (clock_start != clock_t (-1)); // Added if (option == ALL_FIBS) { Fibonacci fib(N); fib.show_all_numbers(); } if (option == TH_FIB) { Fibonacci fib(N); fib.show_last_number(); } if (option == SOME_FIBS) { Fibonacci fib; for (int i = 2; i < argc; i++) fib.show_number (atoi(argv[i])); } if (option == RAND_FIBS) { const int max_rand_fib = (argc == 3) ? MAX_RAND_FIB : atoi (argv[3]); Fibonacci fib; for (uint i = 0; i < N; i++) fib.show_number (rand()%max_rand_fib); } // ------ Added : BEGIN ------ const clock_t clock_end = clock(); assert (clock_end != clock_t (-1)); cerr << "CPU time used : " << (double (clock_end - clock_start)/CLOCKS_PER_SEC) << " sec" << endl; // ------ Added : END -------- return 0; } // ------ Updated main() : END -------- ----------------------------- Note-2. To get the real time used the time() utility was used. -- ===================================== Alex Vinokur mailto:alexvn AT connect DOT to http://mathforum.org/library/view/10978.html news://news.gmane.org/gmane.comp.lang.c++.perfometer =====================================
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |