473,765 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sorting : Comparative performance measurement

=============== =============== =====
------------- Sorting -------------
Comparative performance measurement
=============== =============== =====

Testsuite : Comparing Function Objects to Function Pointers
Source : Technical Report on C++ Performance
Tool : The C/C++ Program Perfometer (Version 2.8.1-1.19-Beta)
* http://sourceforge.net/projects/cpp-perfometer/
Environment :
Windows 2000 Professional Ver 5.0 Build 2195 Service Pack 4
Intel(R) Celeron(R) CPU 1.70 GHz
CYGWIN_NT-5.0 1.5.10(0.116/4/2) i686 Cygwin
GNU g++ version 3.3.3 (cygming special) - Mingw

Compilation :
g++ -mno-cygwin *.cpp

DLLs : The names of DLL files on which the C++ Perfometer program depends
C:\cygwin\bin\c ygwin1.dll
C:\WINNT\System 32\KERNEL32.dll
C:\WINNT\System 32\NTDLL.DLL

#============== =============== =============== =============== ==========
# ------------------- Sorting -------------------
# Comparing Function Objects to Function Pointers
# ---- Summary ---
# ----------------
# ----------------------------------------
# The testsuite is from
# Technical Report on C++ Performance
# ISO/IEC PDTR 18015; Date: 2003-08-11; WG21 N1487=03-0070
# Appendix D: Timing Code
# SubAppendix D4
# ----------------------------------------
# * http://std.dkuug.dk/JTC1/SC22/WG21/docs/PDTR18015.pdf
# * http://anubis.dkuug.dk/jtc1/sc22/wg2...2003/n1487.pdf
# ----------------------------------------
# Several testsuites have been added
# - using pointers (instead of iterators) in sort()
# - stable_sort()
#---------------------------------------------------------------------
# Resource Name : CPU-time used
# Resource Cost Unit : clock
# Resource State Unit : clock
#============== =============== =============== =============== ==========
# Total repetitions : 100
# Performance metrics : clock / 100 repetitions
#============== =============== =============== =============== ==========
Measurement has been performed for the following optimization levels:
* No optimization
* Optimization O2

Total 100 repetitions
Performance = milliseconds per 100 repetitions
sort is std::sort()
stable_sort is std::stable_sor t()
Here are summary results of the measurement.
--------------------------------------------

=============== =============== =============== ===
No optimization
=============== =============== =============== ===

|============== =============== =============== =============== ============
| sort type : sorted : access : function/functor | data size |
| : object : via : | 1000 : 10000 |
|----------------------------------------------------------------------|
| qsort : array : : function pointer | 93 : 1669 |
| : : : | : |
| : : : | : |
| sort : array : : function pointer | 280 : 4286 |
| sort : array : : user functor | 93 : 1382 |
| sort : array : : user inline functor | 93 : 1348 |
| sort : array : : standard functor | 100 : 1395 |
| sort : array : : native < operator | 80 : 1311 |
| : : : | : |
| sort : vector : iterator : standard functor | 127 : 1779 |
| sort : vector : iterator : native < operator | 107 : 1489 |
| sort : vector : iterator : function pointer | 360 : 5221 |
| : : : | : |
| sort : vector : pointer : standard functor | 93 : 1405 |
| sort : vector : pointer : native < operator | 86 : 1305 |
| sort : vector : pointer : function pointer | 307 : 4199 |
| : : : | : |
| : : : | : |
| stable_sort : array : : function pointer | 297 : 4219 |
| stable_sort : array : : user functor | 93 : 1292 |
| stable_sort : array : : user inline functor | 100 : 1342 |
| stable_sort : array : : standard functor | 93 : 1325 |
| stable_sort : array : : native < operator | 60 : 901 |
| : : : | : |
| stable_sort : vector : iterator : standard functor | 166 : 2253 |
| stable_sort : vector : iterator : native < operator | 150 : 2036 |
| stable_sort : vector : iterator : function pointer | 334 : 4490 |
| : : : | : |
| stable_sort : vector : pointer : standard functor | 62 : 791 |
| stable_sort : vector : pointer : native < operator | 20 : 367 |
| stable_sort : vector : pointer : function pointer | 200 : 2633 |
| : : : | : |
|============== =============== =============== =============== ============


=============== =============== =============== ===
Optimization O2
=============== =============== =============== ===

|============== =============== =============== =============== ============
| sort type : sorted : access : function/functor | data size |
| : object : via : | 1000 : 10000 |
|----------------------------------------------------------------------|
| qsort : array : : function pointer | 113 : 1629 |
| : : : | : |
| : : : | : |
| sort : array : : function pointer | 243 : 2857 |
| sort : array : : user functor | 73 : 1134 |
| sort : array : : user inline functor | 40 : 597 |
| sort : array : : standard functor | 40 : 540 |
| sort : array : : native < operator | 56 : 774 |
| : : : | : |
| sort : vector : iterator : standard functor | 43 : 551 |
| sort : vector : iterator : native < operator | 107 : 1462 |
| sort : vector : iterator : function pointer | 260 : 2991 |
| : : : | : |
| sort : vector : pointer : standard functor | 40 : 524 |
| sort : vector : pointer : native < operator | 56 : 767 |
| sort : vector : pointer : function pointer | 250 : 2954 |
| : : : | : |
| : : : | : |
| stable_sort : array : : function pointer | 73 : 1054 |
| stable_sort : array : : user functor | 70 : 1015 |
| stable_sort : array : : user inline functor | 43 : 684 |
| stable_sort : array : : standard functor | 43 : 704 |
| stable_sort : array : : native < operator | 56 : 804 |
| : : : | : |
| stable_sort : vector : iterator : standard functor | 53 : 684 |
| stable_sort : vector : iterator : native < operator | 70 : 964 |
| stable_sort : vector : iterator : function pointer | 193 : 2500 |
| : : : | : |
| stable_sort : vector : pointer : standard functor | 20 : 323 |
| stable_sort : vector : pointer : native < operator | 20 : 327 |
| stable_sort : vector : pointer : function pointer | 33 : 504 |
| : : : | : |
|============== =============== =============== =============== ============
--
Alex Vinokur
http://mathforum.org/library/view/10978.html
http://sourceforge.net/users/alexvn

Jul 22 '05 #1
0 2668

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2979
by: Alex Vinokur | last post by:
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
8
3969
by: Alex Vinokur | last post by:
Various forms of argument passing ================================= C/C++ Performance Tests ======================= Using C/C++ Program Perfometer http://sourceforge.net/projects/cpp-perfometer http://alexvn.freeservers.com/s1/perfometer.html
18
3058
by: Matthias Kaeppler | last post by:
Hi, in my program, I have to sort containers of objects which can be 2000 items big in some cases. Since STL containers are based around copying and since I need to sort these containers quite frequently, I thought it'd be a better idea to manage additional containers which are initialized with pointers to the objects in the primary containers and sort those (only pointers have to be copied around then). However, that also means if I...
10
3655
by: Bob | last post by:
Sorting the following alphanumerics using myArray.sort(): 04-273-0001 04-272-0001 04-272-0003 04-272-0001 04-273-0001 Results in:
6
5225
by: Alex Vinokur | last post by:
Here are results of comparative performance tests carried out using the same compiler (gcc 3.2) in different environments (CYGWIN, MINGW, DJGPP) on Windows 2000 Professional. The following C-functions were tested : * strcpy * memcpy * memmove
6
2950
by: toton | last post by:
Hi, Anyone have a link to comparative study of different C++ compilers and how much they conform to C++ language standard? Most of the big platforms I know have GCC which well supports C++ standard. But mainly looking for compilers for small platforms like ARM, XScale, OMAP processors, and mobile OS's. I am not getting enough imformation which of the platforms HAVE a C++ compiler/cross compiler and how much they support C++ standard. It...
7
2391
by: abracadabra | last post by:
I am reading an old book - Programming Pearls 2nd edition recently. It says, "Even though the general C++ program uses 50 times the memory and CPU time of the specialized C program, it requires just half the code and is much easier to extend to other problems." in a sorting problem of the very first chapter. I modified the codes in the answer part, ran it and found it is almost the contrary case. The qsortints.c is the C code that uses...
1
2389
by: Ted | last post by:
I have cross posted this to comp.lang.c++ and to sci.math.num- analysis in the belief that the topic is of interest to some in both groups. I am building my toolkit, in support of my efforts in producing high performance C++ code; code that is provably correct. The issue here is orthogonal to the question of expression templates, which at present seem to me to be relatively simple.
2
3611
by: josrom | last post by:
Someone knows where to obtain a comparative picture of Performance Between Pro*C Code and PL/SQL Code??? Tested Items ------------------------ Owner SQL Portability Structure of information Documentation Facility of Use
0
9398
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9951
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8831
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7375
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5419
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2805
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.