

        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)
          Intel(R) Celeron(R) CPU 1.70 GHz
          GNU gcc/g++ version 3.2 20020927 (prerelease)
          Compilation : No optimization




                             Testsuites
                             ----------

  1. C-string initialization
     Raw Log : http://groups.google.com/groups?selm=bcs4nc$lsdbq$1@ID-79865.news.dfncis.de

  2. string initialization (C vs. STL)
     Raw Log : http://groups.google.com/groups?selm=bcs72j$ljpau$8@ID-79865.news.dfncis.de

  3. string length (C vs. STL)
     Raw Log : http://groups.google.com/groups?selm=bcs72e$ljpau$7@ID-79865.news.dfncis.de

  4. string assignment and addition (C vs. STL) - 1
     Raw Log : http://groups.google.com/groups?selm=bcs724$ljpau$6@ID-79865.news.dfncis.de

  5. string assignment and addition (C vs. STL) - 2
     Raw Log : http://groups.google.com/groups?selm=bcs71t$ljpau$5@ID-79865.news.dfncis.de

  6. find method vs. find algorithm
     Raw Log : http://groups.google.com/groups?selm=bcs71j$ljpau$4@ID-79865.news.dfncis.de

  7. for-loop vs. for_each
     Raw Log : http://groups.google.com/groups?selm=bcs715$ljpau$3@ID-79865.news.dfncis.de

  8. access to element
     Raw Log : http://groups.google.com/groups?selm=bcs70m$ljpau$2@ID-79865.news.dfncis.de

  9. calling functions : templated vs. non-templated
     Raw Log : http://groups.google.com/groups?selm=bcs70m$ljpau$2@ID-79865.news.dfncis.de 




                                 Summary test results
                                 --------------------

      HTML Versions : http://article.gmane.org/gmane.comp.gcc.g++.general/101
                      http://mail.gnu.org/archive/html/help-gplusplus/2003-06/msg00003.html
                      news://news.gmane.org/bd13qj$s86$1@main.gmane.org (via NNTP newsreader)
                      news://msnnews.msn.com/uI#FPx8NDHA.1908@TK2MSFTNGP11.phx.gbl (via NNTP newsreader)

      Unit of Measurement = milliseconds/per-times-value
  == |=========================================================================|
     |                           :              :  Size performance  :  Per-   |
  No.|          Method           :  Data Type   :--------------------: times-  |
     |                           :              :   10 :  100 : 1000 : value   |
  == |=========================================================================|
  1. | init (char* x = y)        : char*        :    4 :    4 :    4 : 1000000 |
     | init (char[] x = y)       : char[]       :    5 :  232 :  402 :         |
  -- |-------------------------------------------------------------------------|
  2. | malloc & free             : char[]       :  132 :  162 :  162 :  100000 |
     | (malloc+strcpy) & free    : char[]       :  137 :  179 :  274 :         |
     | (malloc+memset) & free    : char[]       :  161 :  187 :  217 :         |
     | ctor & dtor               : string       :   30 :  30  :   30 :         |
     | new & delete              : string       :  223 :  274 :  892 :         |
  -- |-------------------------------------------------------------------------|
  3. | strlen                    : char[]       :  222 :  693 : 5410 : 1000000 |
     | string.size()             : string       :   16 :   15 :   15 :         |
  -- |-------------------------------------------------------------------------|
  4. | strcpy                    : char[]       :    6 :   22 :  147 :  100000 |
     | operator=                 : string       :    3 :    3 :    3 :         |
     | strcat (with cutting off) : char[]       :   10 :   26 :  152 :         |
     | operator+= (with erase)   : string       :  100 :  112 :  184 :         |
     | operator+ (with erase)    : string       :  234 :  234 :  508 :         |
  -- |-------------------------------------------------------------------------|
  5. | accumulated strcat        : char[]       : 1090 : 1194 : 1277 :   10000 |
     |    (with cutting off)     :              :      :      :      :         |
     | accumulated operator+=    : string       :   10 :   12 :   20 :         |
     |    (with erase)           :              :      :      :      :         |
     | accumulated operator+     : string       : 6311 : 6993 : 7280 :         |
     |    (with erase)           :              :      :      :      :         |
  -- |-------------------------------------------------------------------------|
  6. | find algorithm            : vector<int>  :    2 :    8 :   69 :   10000 |
     | find algorithm            : list<int>    :    2 :   15 :  142 :         |
     | find algorithm            : set<int>     :    3 :   22 :  217 :         |
     | find method               : set<int>     :    2 :    4 :    4 :         |
     | find method               : map<int>     :    2 :    4 :    4 :         |
  -- |-------------------------------------------------------------------------|
  7. | for-loop                  : vector<uint> :   13 :  124 : 1225 :   10000 |
     | for-loop                  : string       :   14 :  120 : 1189 :         |
     | for-loop                  : list<uint>   :   15 :  133 : 1330 :         |
     | for-loop                  : set<uint>    :   13 :  129 : 1311 :         |
     | for_each                  : vector<uint> :   10 :   92 :  915 :         |
     | for_each                  : string       :   10 :   93 :  917 :         |
     | for_each                  : list<uint>   :    9 :   78 :  773 :         |
     | for_each                  : set<uint>    :   12 :  104 : 1070 :         |
  -- |-------------------------------------------------------------------------|
  8. | operator[]                : char[]       :    5 :    5 :    4 : 1000000 |
     | operator[]                : vector<char> :   90 :   90 :   90 :         |
     | operator[]                : string       :   34 :   34 :   33 :         |
     | at method                 : vector<char> :  222 :  222 :  223 :         |
     | at method                 : string       :   32 :   33 :   33 :         |
  -- |-------------------------------------------------------------------------|
  9. | templated function        : int          :          16        : 1000000 |
     | ordinary function         : int          :           5        :         |
     | templated function        : string       :  344 :  345 :  345 :         |
     | ordinary function         : string       :  344 :  345 :  350 :         |
  == |=========================================================================|



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

     07 Jule 2003



