Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Performance of the same compiler (gcc 3.2) in different environments

0 views
Skip to first unread message

Alex Vinokur

unread,
Aug 26, 2003, 11:52:38 AM8/26/03
to

Here are results of comparative performance tests carried out
using the same compiler (gcc/g++/gpp 3.2)
in different environments (CYGWIN, MINGW, DJGPP)
on Windows 2000 Professional.


Different methods of copying files were tested :

------ C methods ------
Method C-1 : Functions getc() and putc()
Method C-2 : Functions fgetc() and fputc()

------ C++ methods ------
Method CPP-1 : Operators >> and <<
Method CPP-2 : Methods get() and put()
Method CPP-3 : Methods sbumpc() and sputc()
Method CPP-4 : Method sbumpc() and operator <<
Method CPP-5 : Method rdbuf() and operator <<


We can see that the results for CYGWIN and DJGPP are consistent, in particular:
C-methods C-1 and C-2 are faster than C++-methods CPP-1, CPP-2, CPP-3.

Whereas it seems that C-methods C-1 and C-2 on MINGW are too slow.
For instance,
C-methods C-1 and C-2 are slower than C++-methods CPP-2, CPP-3.

The summary results are below.


#################################################################

Copying files : input to output
===============================

C/C++ Performance Tests
=======================
Using C/C++ Program Perfometer
http://sourceforge.net/projects/cpp-perfometer
http://alexvn.freeservers.com/s1/perfometer.html

Environment
-----------
Windows 2000 Professional
* CYGWIN_NT-5.0 1.3.22(0.78/3/2)
* MINGW 2.0.0.-2
* DJGPP 2.03
Intel(R) Celeron(R) CPU 1.70 GHz
GNU g++/gpp 3.2
Compilation : No optimization

#################################################
Stream I/O performance tests below are based
on the article "Stream I/O"
presented at http://www.glenmccl.com/strm_cmp.htm
by Glen McCluskey & Associates LLC
#################################################

===================== Methods of copying : BEGIN =====================

FILE* fp_in;
FILE* fp_out;

ifstream fs_in;
ofstream fs_out;


char ch;
int ich;

Method C-1 : Functions getc() and putc()
-----------------------------------------------------
while ((ich = getc(fp_in)) != EOF) putc(ich, fp_out);
-----------------------------------------------------


Method C-2 : Functions fgetc() and fputc()
-------------------------------------------------------
while ((ich = fgetc(fp_in)) != EOF) fputc(ich, fp_out);
-------------------------------------------------------


Method CPP-1 : Operators >> and <<
---------------------------------
fs_in.unsetf(ios::skipws);
while (fs_in >> ch) fs_out << ch;
---------------------------------


Method CPP-2 : Methods get() and put()
-------------------------------------
while (fs_in.get(ch)) fs_out.put(ch);
-------------------------------------


Method CPP-3 : Methods sbumpc() and sputc()
------------------------------------------------------------------------
while ((ch = fs_in.rdbuf()->sbumpc()) != EOF) fs_out.rdbuf()->sputc(ch);
------------------------------------------------------------------------


Method CPP-4 : Method sbumpc() and operator <<
-------------------------------
ch = fs_in.rdbuf()->sbumpc();
fs_out << ch;
while (ch != EOF)
{
fs_out << fs_in.rdbuf();
ch = fs_in.rdbuf()->sbumpc();
}
-------------------------------


Method CPP-5 : Method rdbuf() and operator <<
------------------------
fs_out << fs_in.rdbuf();
------------------------

===================== Methods of copying : END =======================


================ Performance tests : BEGIN ================

#==========================================================
# Comparison : copying files : input to output
#----------------------------------------------------------
# Resource Name : user time used (via rusage)
# Resource Cost Unit : milliseconds (unsigned long long)
# Resource State Unit : timeval
#==========================================================

Summary test results
CYGWIN_NT-5.0 1.3.22(0.78/3/2)
gcc/g++ version 3.2 20020927 (prerelease)
============================
--------------------------------------------------------------------
| | | User time used for |
| No. | Method | file size |
| | |-----------------------|
| | | 100 | 1000 | 10000 |
|------------------------------------------------------------------|
| C-1 | Functions getc() and putc() | 20 | 50 | 405 |
| C-2 | Functions fgetc() and fputc() | 11 | 51 | 417 |
| | | | | |
| CPP-1 | Operators >> and << | 53 | 405 | 3970 |
| CPP-2 | Methods get() and put() | 30 | 182 | 1714 |
| CPP-3 | Methods sbumpc() and sputc() | 26 | 99 | 923 |
| CPP-4 | Method sbumpc() and operator << | 21 | 48 | 331 |
| CPP-5 | Method rdbuf() and operator << | 16 | 35 | 322 |
--------------------------------------------------------------------
Raw Log : http://groups.google.com/groups?selm=bifd35%248r6pm%241%40ID-79865.news.uni-berlin.de

Summary test results
MINGW 2.0.0-2
gcc/g++ version 3.2 (mingw special 20020817-1)
============================
--------------------------------------------------------------------
| | | User time used for |
| No. | Method | file size |
| | |-----------------------|
| | | 100 | 1000 | 10000 |
|------------------------------------------------------------------|
| C-1 | Functions getc() and putc() | 30 | 190 | 1882 | Too slow?
| C-2 | Functions fgetc() and fputc() | 31 | 190 | 2032 | Too slow?
| | | | | |
| CPP-1 | Operators >> and << | 46 | 268 | 2854 |
| CPP-2 | Methods get() and put() | 31 | 145 | 1503 |
| CPP-3 | Methods sbumpc() and sputc() | 26 | 85 | 846 |
| CPP-4 | Method sbumpc() and operator << | 25 | 40 | 261 |
| CPP-5 | Method rdbuf() and operator << | 20 | 35 | 255 |
--------------------------------------------------------------------
Raw Log : http://groups.google.com/groups?selm=bifd3o%248r6pm%242%40ID-79865.news.uni-berlin.de

Summary test results
DJGPP 2.03
gcc/gpp version 3.2.1
============================
--------------------------------------------------------------------
| | | User time used for |
| No. | Method | file size |
| | |-----------------------|
| | | 100 | 1000 | 10000 |
|------------------------------------------------------------------|
| C-1 | Functions getc() and putc() | 54 | 109 | 374 |
| C-2 | Functions fgetc() and fputc() | 54 | 81 | 374 |
| | | | | |
| CPP-1 | Operators >> and << | 109 | 255 | 1758 |
| CPP-2 | Methods get() and put() | 90 | 164 | 979 |
| CPP-3 | Methods sbumpc() and sputc() | 81 | 109 | 494 |
| CPP-4 | Method sbumpc() and operator << | 72 | 99 | 219 |
| CPP-5 | Method rdbuf() and operator << | 90 | 72 | 219 |
--------------------------------------------------------------------
Raw Log : http://groups.google.com/groups?selm=bifd4a%248r6pm%243%40ID-79865.news.uni-berlin.de

================ Performance tests : END ==================


==============================================
Alex Vinokur
mailto:ale...@connect.to
http://mathforum.org/library/view/10978.html
==============================================


Robert Heller

unread,
Aug 26, 2003, 1:47:45 PM8/26/03
to
"Alex Vinokur" <ale...@bigfoot.com>,
In a message on Tue, 26 Aug 2003 18:52:38 +0300, wrote :

"V> Here are results of comparative performance tests carried out
"V> using the same compiler (gcc/g++/gpp 3.2)
"V> in different environments (CYGWIN, MINGW, DJGPP)
"V> on Windows 2000 Professional.
"V>
"V>
"V> Different methods of copying files were tested :
"V>
"V> ------ C methods ------
"V> Method C-1 : Functions getc() and putc()
"V> Method C-2 : Functions fgetc() and fputc()
"V>
"V> ------ C++ methods ------
"V> Method CPP-1 : Operators >> and <<
"V> Method CPP-2 : Methods get() and put()
"V> Method CPP-3 : Methods sbumpc() and sputc()
"V> Method CPP-4 : Method sbumpc() and operator <<
"V> Method CPP-5 : Method rdbuf() and operator <<
"V>
"V>
"V> We can see that the results for CYGWIN and DJGPP are consistent, in particular:
"V> C-methods C-1 and C-2 are faster than C++-methods CPP-1, CPP-2, CPP-3.
"V>
"V> Whereas it seems that C-methods C-1 and C-2 on MINGW are too slow.
"V> For instance,
"V> C-methods C-1 and C-2 are slower than C++-methods CPP-2, CPP-3.

You do understand that CYGWIN and DJGPP are using Open Source (GNU?) C/C++
run-time libraries and that MINGW is using Microsoft's C/C++ run-time
libraries...

"V>
"V>
"V>
"V> The summary results are below.
"V>
"V>
"V> #################################################################
"V>
"V> Copying files : input to output
"V> ===============================
"V>
"V> C/C++ Performance Tests
"V> =======================
"V> Using C/C++ Program Perfometer
"V> http://sourceforge.net/projects/cpp-perfometer
"V> http://alexvn.freeservers.com/s1/perfometer.html
"V>
"V>
"V>
"V> Environment
"V> -----------
"V> Windows 2000 Professional
"V> * CYGWIN_NT-5.0 1.3.22(0.78/3/2)
"V> * MINGW 2.0.0.-2
"V> * DJGPP 2.03
"V> Intel(R) Celeron(R) CPU 1.70 GHz
"V> GNU g++/gpp 3.2
"V> Compilation : No optimization
"V>
"V>
"V>
"V> #################################################
"V> Stream I/O performance tests below are based
"V> on the article "Stream I/O"
"V> presented at http://www.glenmccl.com/strm_cmp.htm
"V> by Glen McCluskey & Associates LLC
"V> #################################################
"V>
"V>
"V>
"V> ===================== Methods of copying : BEGIN =====================
"V>
"V> FILE* fp_in;
"V> FILE* fp_out;
"V>
"V> ifstream fs_in;
"V> ofstream fs_out;
"V>
"V>
"V> char ch;
"V> int ich;
"V>
"V>
"V>
"V> Method C-1 : Functions getc() and putc()
"V> -----------------------------------------------------
"V> while ((ich = getc(fp_in)) != EOF) putc(ich, fp_out);
"V> -----------------------------------------------------
"V>
"V>
"V> Method C-2 : Functions fgetc() and fputc()
"V> -------------------------------------------------------
"V> while ((ich = fgetc(fp_in)) != EOF) fputc(ich, fp_out);
"V> -------------------------------------------------------
"V>
"V>
"V> Method CPP-1 : Operators >> and <<
"V> ---------------------------------
"V> fs_in.unsetf(ios::skipws);
"V> while (fs_in >> ch) fs_out << ch;
"V> ---------------------------------
"V>
"V>
"V> Method CPP-2 : Methods get() and put()
"V> -------------------------------------
"V> while (fs_in.get(ch)) fs_out.put(ch);
"V> -------------------------------------
"V>
"V>
"V> Method CPP-3 : Methods sbumpc() and sputc()
"V> ------------------------------------------------------------------------
"V> while ((ch = fs_in.rdbuf()->sbumpc()) != EOF) fs_out.rdbuf()->sputc(ch);
"V> ------------------------------------------------------------------------
"V>
"V>
"V> Method CPP-4 : Method sbumpc() and operator <<
"V> -------------------------------
"V> ch = fs_in.rdbuf()->sbumpc();
"V> fs_out << ch;
"V> while (ch != EOF)
"V> {
"V> fs_out << fs_in.rdbuf();
"V> ch = fs_in.rdbuf()->sbumpc();
"V> }
"V> -------------------------------
"V>
"V>
"V> Method CPP-5 : Method rdbuf() and operator <<
"V> ------------------------
"V> fs_out << fs_in.rdbuf();
"V> ------------------------
"V>
"V>
"V>
"V> ===================== Methods of copying : END =======================
"V>
"V>
"V>
"V>
"V> ================ Performance tests : BEGIN ================
"V>
"V>
"V>
"V> #==========================================================
"V> # Comparison : copying files : input to output
"V> #----------------------------------------------------------
"V> # Resource Name : user time used (via rusage)
"V> # Resource Cost Unit : milliseconds (unsigned long long)
"V> # Resource State Unit : timeval
"V> #==========================================================
"V>
"V>
"V>
"V> Summary test results
"V> CYGWIN_NT-5.0 1.3.22(0.78/3/2)
"V> gcc/g++ version 3.2 20020927 (prerelease)
"V> ============================
"V> --------------------------------------------------------------------
"V> | | | User time used for |
"V> | No. | Method | file size |
"V> | | |-----------------------|
"V> | | | 100 | 1000 | 10000 |
"V> |------------------------------------------------------------------|
"V> | C-1 | Functions getc() and putc() | 20 | 50 | 405 |
"V> | C-2 | Functions fgetc() and fputc() | 11 | 51 | 417 |
"V> | | | | | |
"V> | CPP-1 | Operators >> and << | 53 | 405 | 3970 |
"V> | CPP-2 | Methods get() and put() | 30 | 182 | 1714 |
"V> | CPP-3 | Methods sbumpc() and sputc() | 26 | 99 | 923 |
"V> | CPP-4 | Method sbumpc() and operator << | 21 | 48 | 331 |
"V> | CPP-5 | Method rdbuf() and operator << | 16 | 35 | 322 |
"V> --------------------------------------------------------------------
"V> Raw Log : http://groups.google.com/groups?selm=bifd35%248r6pm%241%40ID-79865.news.uni-berlin.de
"V>
"V>
"V>
"V> Summary test results
"V> MINGW 2.0.0-2
"V> gcc/g++ version 3.2 (mingw special 20020817-1)
"V> ============================
"V> --------------------------------------------------------------------
"V> | | | User time used for |
"V> | No. | Method | file size |
"V> | | |-----------------------|
"V> | | | 100 | 1000 | 10000 |
"V> |------------------------------------------------------------------|
"V> | C-1 | Functions getc() and putc() | 30 | 190 | 1882 | Too slow?
"V> | C-2 | Functions fgetc() and fputc() | 31 | 190 | 2032 | Too slow?
"V> | | | | | |
"V> | CPP-1 | Operators >> and << | 46 | 268 | 2854 |
"V> | CPP-2 | Methods get() and put() | 31 | 145 | 1503 |
"V> | CPP-3 | Methods sbumpc() and sputc() | 26 | 85 | 846 |
"V> | CPP-4 | Method sbumpc() and operator << | 25 | 40 | 261 |
"V> | CPP-5 | Method rdbuf() and operator << | 20 | 35 | 255 |
"V> --------------------------------------------------------------------
"V> Raw Log : http://groups.google.com/groups?selm=bifd3o%248r6pm%242%40ID-79865.news.uni-berlin.de
"V>
"V>
"V>
"V> Summary test results
"V> DJGPP 2.03
"V> gcc/gpp version 3.2.1
"V> ============================
"V> --------------------------------------------------------------------
"V> | | | User time used for |
"V> | No. | Method | file size |
"V> | | |-----------------------|
"V> | | | 100 | 1000 | 10000 |
"V> |------------------------------------------------------------------|
"V> | C-1 | Functions getc() and putc() | 54 | 109 | 374 |
"V> | C-2 | Functions fgetc() and fputc() | 54 | 81 | 374 |
"V> | | | | | |
"V> | CPP-1 | Operators >> and << | 109 | 255 | 1758 |
"V> | CPP-2 | Methods get() and put() | 90 | 164 | 979 |
"V> | CPP-3 | Methods sbumpc() and sputc() | 81 | 109 | 494 |
"V> | CPP-4 | Method sbumpc() and operator << | 72 | 99 | 219 |
"V> | CPP-5 | Method rdbuf() and operator << | 90 | 72 | 219 |
"V> --------------------------------------------------------------------
"V> Raw Log : http://groups.google.com/groups?selm=bifd4a%248r6pm%243%40ID-79865.news.uni-berlin.de
"V>
"V>
"V>
"V> ================ Performance tests : END ==================
"V>
"V>
"V> ==============================================
"V> Alex Vinokur
"V> mailto:ale...@connect.to
"V> http://mathforum.org/library/view/10978.html
"V> ==============================================
"V>
"V>
"V>
"V>
"V>
"V>
"V>
"V>
"V>

\/
Robert Heller ||InterNet: hel...@cs.umass.edu
http://vis-www.cs.umass.edu/~heller || hel...@deepsoft.com
http://www.deepsoft.com /\FidoNet: 1:321/153



Alex Vinokur

unread,
Aug 27, 2003, 12:09:55 AM8/27/03
to

"Robert Heller" <hel...@deepsoft.com> wrote in message news:e54f5$3f4b9d41$d0c7e1fd$28...@nf1.news-service.com...
[snip]

Are CYGWIN, DJGPP and MINGW using the same C++ iostream libraries?

0 new messages