locked
C++ Performance Benchmarks (VC++ 2008 vs. MinGW gcc 4.3) RRS feed

  • Question

  • I just built (release version) and run Adobe "C++ Performance Benchmarks" with VC++ 2008 and MinGW gcc 4.3 and I observed that VC++ 2008 is much slower.
    Here is part of the result on my machine:

    ##Start machine report version 1.0
    ##Compiler
    GCC version 4.3.0
    ##Target CPU
    Compiled for x86 32bit
    ##Physical CPU
    Little Endian
    ##Machine
    ##Operating System
    ##End machine report

    \cpp_performance_benchmark\Release\cpp_performance_benchmark.exe 1000

    test                         description   absolute   operations   ratio with
    number                                     time       per second   test0

     0                 "int8_t variable add"   0.05 sec   173.91 M     1.00
     1       "int8_t multiple variable adds"   0.03 sec   250.00 M     0.70
     2            "int8_t variable subtract"   0.00 sec    1.#J M     0.00
     3  "int8_t multiple variable subtracts"   0.03 sec   258.06 M     0.67
     4            "int8_t variable multiply"   0.02 sec   500.00 M     0.35
     5 "int8_t multiple variable multiplies"   0.01 sec   533.33 M     0.33
     6              "int8_t variable divide"   0.06 sec   126.98 M     1.37
     7    "int8_t multiple variable divides"   0.17 sec   46.51 M     3.74
     8      "int8_t multiple variable mixed"   0.03 sec   258.06 M     0.67
     9                 "int8_t variable and"   0.01 sec   533.33 M     0.33
    10        "int8_t multiple variable and"   0.02 sec   500.00 M     0.35
    11                  "int8_t variable or"   0.02 sec   500.00 M     0.35
    12         "int8_t multiple variable or"   0.01 sec   533.33 M     0.33
    13                 "int8_t variable xor"   0.03 sec   250.00 M     0.70
    14        "int8_t multiple variable xor"   0.01 sec   533.33 M     0.33

    Total absolute time for int8_t loop invariant: 0.52 sec

    test                          description   absolute   operations   ratio with
    number                                      time       per second   test0

     0                 "uint8_t variable add"   0.00 sec    1.#J M     -1.#J
     1       "uint8_t multiple variable adds"   0.03 sec   258.06 M     1.#J
     2            "uint8_t variable subtract"   0.00 sec    1.#J M     -1.#J
     3  "uint8_t multiple variable subtracts"   0.03 sec   250.00 M     1.#J
     4            "uint8_t variable multiply"   0.01 sec   533.33 M     1.#J
     5 "uint8_t multiple variable multiplies"   0.02 sec   500.00 M     1.#J
     6              "uint8_t variable divide"   0.06 sec   129.03 M     1.#J
     7    "uint8_t multiple variable divides"   0.20 sec   39.22 M     1.#J
     8      "uint8_t multiple variable mixed"   0.03 sec   258.06 M     1.#J
     9                 "uint8_t variable and"   0.00 sec    1.#J M     -1.#J
    10        "uint8_t multiple variable and"   0.01 sec   533.33 M     1.#J
    11                  "uint8_t variable or"   0.02 sec   500.00 M     1.#J
    12         "uint8_t multiple variable or"   0.02 sec   500.00 M     1.#J
    13                 "uint8_t variable xor"   0.01 sec   533.33 M     1.#J
    14        "uint8_t multiple variable xor"   0.08 sec   102.56 M     1.#J

    Total absolute time for uint8_t loop invariant: 0.53 sec

    test                          description   absolute   operations   ratio with
    number                                      time       per second   test0

     0                 "int16_t variable add"   0.02 sec   500.00 M     1.00
     1       "int16_t multiple variable adds"   0.02 sec   500.00 M     1.00
     2            "int16_t variable subtract"   0.05 sec   170.21 M     2.94
     3  "int16_t multiple variable subtracts"   0.03 sec   258.06 M     1.94
     4            "int16_t variable multiply"   0.01 sec   533.33 M     0.94
     5 "int16_t multiple variable multiplies"   0.02 sec   500.00 M     1.00
     6              "int16_t variable divide"   0.09 sec   85.11 M     5.88
     7    "int16_t multiple variable divides"   0.28 sec   28.47 M     17.56
     8      "int16_t multiple variable mixed"   0.02 sec   500.00 M     1.00
     9                 "int16_t variable and"   0.03 sec   258.06 M     1.94
    10        "int16_t multiple variable and"   0.02 sec   500.00 M     1.00
    11                  "int16_t variable or"   0.05 sec   173.91 M     2.88
    12         "int16_t multiple variable or"   0.02 sec   500.00 M     1.00
    13                 "int16_t variable xor"   0.03 sec   258.06 M     1.94
    14        "int16_t multiple variable xor"   0.02 sec   500.00 M     1.00

    Total absolute time for int16_t loop invariant: 0.69 sec

    test                           description   absolute   operations   ratio with
    number                                       time       per second   test0

     0                 "uint16_t variable add"   0.02 sec   500.00 M     1.00
     1       "uint16_t multiple variable adds"   0.05 sec   173.91 M     2.88
     2            "uint16_t variable subtract"   0.02 sec   500.00 M     1.00
     3  "uint16_t multiple variable subtracts"   0.02 sec   500.00 M     1.00
     4            "uint16_t variable multiply"   0.05 sec   170.21 M     2.94
     5 "uint16_t multiple variable multiplies"   0.01 sec   533.33 M     0.94
     6              "uint16_t variable divide"   0.09 sec   85.11 M     5.88
     7    "uint16_t multiple variable divides"   0.23 sec   34.19 M     14.63
     8      "uint16_t multiple variable mixed"   0.02 sec   500.00 M     1.00
     9                 "uint16_t variable and"   0.02 sec   500.00 M     1.00
    10        "uint16_t multiple variable and"   0.03 sec   258.06 M     1.94
    11                  "uint16_t variable or"   0.01 sec   533.33 M     0.94
    12         "uint16_t multiple variable or"   0.02 sec   500.00 M     1.00
    13                 "uint16_t variable xor"   0.03 sec   258.06 M     1.94
    14        "uint16_t multiple variable xor"   0.02 sec   500.00 M     1.00

    Total absolute time for uint16_t loop invariant: 0.63 sec

    test                          description   absolute   operations   ratio with
    number                                      time       per second   test0

     0                 "int32_t variable add"   0.02 sec   500.00 M     1.00
     1       "int32_t multiple variable adds"   0.00 sec    1.#J M     0.00
     2            "int32_t variable subtract"   0.01 sec   533.33 M     0.94
     3  "int32_t multiple variable subtracts"   0.02 sec   500.00 M     1.00
     4            "int32_t variable multiply"   0.01 sec   533.33 M     0.94
     5 "int32_t multiple variable multiplies"   0.02 sec   500.00 M     1.00
     6              "int32_t variable divide"   0.06 sec   126.98 M     3.94
     7    "int32_t multiple variable divides"   0.19 sec   42.78 M     11.69
     8      "int32_t multiple variable mixed"   0.00 sec    1.#J M     0.00
     9                 "int32_t variable and"   0.02 sec   500.00 M     1.00
    10        "int32_t multiple variable and"   0.01 sec   533.33 M     0.94
    11                  "int32_t variable or"   0.00 sec    1.#J M     0.00
    12         "int32_t multiple variable or"   0.02 sec   500.00 M     1.00
    13                 "int32_t variable xor"   0.02 sec   500.00 M     1.00
    14        "int32_t multiple variable xor"   0.01 sec   533.33 M     0.94

    Total absolute time for int32_t loop invariant: 0.41 sec

    test                           description   absolute   operations   ratio with
    number                                       time       per second   test0

     0                 "uint32_t variable add"   0.00 sec    1.#J M     -1.#J
     1       "uint32_t multiple variable adds"   0.02 sec   500.00 M     1.#J
     2            "uint32_t variable subtract"   0.01 sec   533.33 M     1.#J
     3  "uint32_t multiple variable subtracts"   0.02 sec   500.00 M     1.#J
     4            "uint32_t variable multiply"   0.02 sec   500.00 M     1.#J
     5 "uint32_t multiple variable multiplies"   0.01 sec   533.33 M     1.#J
     6              "uint32_t variable divide"   0.06 sec   126.98 M     1.#J
     7    "uint32_t multiple variable divides"   0.19 sec   42.78 M     1.#J
     8      "uint32_t multiple variable mixed"   0.02 sec   500.00 M     1.#J
     9                 "uint32_t variable and"   0.02 sec   500.00 M     1.#J
    10        "uint32_t multiple variable and"   0.00 sec    1.#J M     -1.#J
    11                  "uint32_t variable or"   0.01 sec   533.33 M     1.#J
    12         "uint32_t multiple variable or"   0.02 sec   500.00 M     1.#J
    13                 "uint32_t variable xor"   0.00 sec    1.#J M     -1.#J
    14        "uint32_t multiple variable xor"   0.01 sec   533.33 M     1.#J

    Total absolute time for uint32_t loop invariant: 0.41 sec

    test                          description   absolute   operations   ratio with
    number                                      time       per second   test0

     0                 "int64_t variable add"   0.03 sec   250.00 M     1.00
     1       "int64_t multiple variable adds"   0.01 sec   533.33 M     0.47
     2            "int64_t variable subtract"   0.02 sec   500.00 M     0.50
     3  "int64_t multiple variable subtracts"   0.05 sec   170.21 M     1.47
     4            "int64_t variable multiply"   0.06 sec   129.03 M     1.94
     5 "int64_t multiple variable multiplies"   0.05 sec   170.21 M     1.47
     6              "int64_t variable divide"   0.11 sec   72.73 M     3.44
     7    "int64_t multiple variable divides"   0.42 sec   19.00 M     13.16
     8      "int64_t multiple variable mixed"   0.02 sec   500.00 M     0.50
     9                 "int64_t variable and"   0.05 sec   170.21 M     1.47
    10        "int64_t multiple variable and"   0.03 sec   258.06 M     0.97
    11                  "int64_t variable or"   0.05 sec   170.21 M     1.47
    12         "int64_t multiple variable or"   0.03 sec   258.06 M     0.97
    13                 "int64_t variable xor"   0.03 sec   250.00 M     1.00
    14        "int64_t multiple variable xor"   0.05 sec   173.91 M     1.44

    Total absolute time for int64_t loop invariant: 1.00 sec

    test                           description   absolute   operations   ratio with
    number                                       time       per second   test0

     0                 "uint64_t variable add"   0.02 sec   500.00 M     1.00
     1       "uint64_t multiple variable adds"   0.02 sec   500.00 M     1.00
     2            "uint64_t variable subtract"   0.03 sec   258.06 M     1.94
     3  "uint64_t multiple variable subtracts"   0.05 sec   170.21 M     2.94
     4            "uint64_t variable multiply"   0.05 sec   170.21 M     2.94
     5 "uint64_t multiple variable multiplies"   0.06 sec   129.03 M     3.88
     6              "uint64_t variable divide"   0.09 sec   85.11 M     5.88
     7    "uint64_t multiple variable divides"   0.39 sec   20.46 M     24.44
     8      "uint64_t multiple variable mixed"   0.03 sec   258.06 M     1.94
     9                 "uint64_t variable and"   0.03 sec   258.06 M     1.94
    10        "uint64_t multiple variable and"   0.03 sec   258.06 M     1.94
    11                  "uint64_t variable or"   0.05 sec   170.21 M     2.94
    12         "uint64_t multiple variable or"   0.03 sec   250.00 M     2.00
    13                 "uint64_t variable xor"   0.03 sec   258.06 M     1.94
    14        "uint64_t multiple variable xor"   0.03 sec   258.06 M     1.94

    Total absolute time for uint64_t loop invariant: 0.94 sec

    test                        description   absolute   operations   ratio with
    number                                    time       per second   test0

     0                 "float variable add"   0.02 sec   500.00 M     1.00
     1       "float multiple variable adds"   0.03 sec   258.06 M     1.94
     2            "float variable subtract"   0.02 sec   500.00 M     1.00
     3  "float multiple variable subtracts"   0.03 sec   258.06 M     1.94
     4            "float variable multiply"   0.01 sec   533.33 M     0.94
     5 "float multiple variable multiplies"   0.03 sec   250.00 M     2.00
     6              "float variable divide"   0.03 sec   258.06 M     1.94
     7    "float multiple variable divides"   0.34 sec   23.26 M     21.50
     8      "float multiple variable mixed"   0.03 sec   258.06 M     1.94

    Total absolute time for float loop invariant: 0.55 sec

    test                         description   absolute   operations   ratio with
    number                                     time       per second   test0

     0                 "double variable add"   0.02 sec   500.00 M     1.00
     1       "double multiple variable adds"   0.01 sec   533.33 M     0.94
     2            "double variable subtract"   0.02 sec   500.00 M     1.00
     3  "double multiple variable subtracts"   0.03 sec   258.06 M     1.94
     4            "double variable multiply"   0.02 sec   500.00 M     1.00
     5 "double multiple variable multiplies"   0.03 sec   258.06 M     1.94
     6              "double variable divide"   0.05 sec   170.21 M     2.94
     7    "double multiple variable divides"   0.36 sec   22.28 M     22.44
     8      "double multiple variable mixed"   0.02 sec   500.00 M     1.00

    Total absolute time for double loop invariant: 0.55 sec
    ======================================
    \cpp_performance_benchmark\Release\cpp_performance_benchmark.exe 100000

    test                        description   absolute   operations   ratio with
    number                                    time       per second   test0

     0                     "double pointer"   0.33 sec   609.76 M     1.00
     1               "double pointer_class"   0.28 sec   711.74 M     0.86
     2         "DoubleValueWrapper pointer"   0.36 sec   557.10 M     1.09
     3   "DoubleValueWrapper pointer_class"   0.33 sec   609.76 M     1.00
     4       "DoubleValueWrapper10 pointer"   0.31 sec   638.98 M     0.95
     5 "DoubleValueWrapper10 pointer_class"   0.36 sec   557.10 M     1.09

    Total absolute time for Abstraction Accumulate: 1.97 sec

    Abstraction Accumulate Penalty: 1.00


    test                                       description   absolute   operations   ratio with
    number                                                   time       per second   test0

     0                     "insertion_sort double pointer"   0.13 sec    0.80 M     1.00
     1               "insertion_sort double pointer_class"   0.16 sec    0.64 M     1.26
     2         "insertion_sort DoubleValueWrapper pointer"   0.13 sec    0.80 M     1.00
     3   "insertion_sort DoubleValueWrapper pointer_class"   0.14 sec    0.71 M     1.12
     4       "insertion_sort DoubleValueWrapper10 pointer"   0.13 sec    0.80 M     1.00
     5 "insertion_sort DoubleValueWrapper10 pointer_class"   0.17 sec    0.58 M     1.38

    Total absolute time for Abstraction Insertion Sort: 0.84 sec

    Abstraction Insertion Sort Penalty: 1.14


    test                                  description   absolute   operations   ratio with
    number                                              time       per second   test0

     0                     "quicksort double pointer"   0.09 sec    8.51 M     1.00
     1               "quicksort double pointer_class"   0.11 sec    7.34 M     1.16
     2         "quicksort DoubleValueWrapper pointer"   0.09 sec    8.51 M     1.00
     3   "quicksort DoubleValueWrapper pointer_class"   0.11 sec    7.34 M     1.16
     4       "quicksort DoubleValueWrapper10 pointer"   0.09 sec    8.51 M     1.00
     5 "quicksort DoubleValueWrapper10 pointer_class"   0.11 sec    7.34 M     1.16

    Total absolute time for Abstraction Quicksort: 0.61 sec

    Abstraction Quicksort Penalty: 1.09


    test                                  description   absolute   operations   ratio with
    number                                              time       per second   test0

     0                     "heap_sort double pointer"   0.14 sec    5.67 M     1.00
     1               "heap_sort double pointer_class"   0.13 sec    6.40 M     0.89
     2         "heap_sort DoubleValueWrapper pointer"   0.17 sec    4.65 M     1.22
     3   "heap_sort DoubleValueWrapper pointer_class"   0.11 sec    7.34 M     0.77
     4       "heap_sort DoubleValueWrapper10 pointer"   0.16 sec    5.10 M     1.11
     5 "heap_sort DoubleValueWrapper10 pointer_class"   0.14 sec    5.71 M     0.99

    Total absolute time for Abstraction Heap Sort: 0.84 sec

    Abstraction Heap Sort Penalty: 0.98


    ==========================================================================
    ##Start machine report version 1.0
    ##Compiler
    Microsoft VisualC++ version 1500
    Compiling for Windows 32 bit
    ##Target CPU
    Compiled for x86 32bit
    Compiled for PentiumII
    ##Physical CPU
    Little Endian
    ##Machine
    ##Operating System
    ##End machine report

    \cpp_performance_benchmark_msvc\Release\cpp_performance_benchmark_msvc.exe 1000

    test                         description   absolute   operations   ratio with
    number                                     time       per second   test0

     0                 "int8_t variable add"   0.09 sec   85.11 M     1.00
     1       "int8_t multiple variable adds"   0.08 sec   102.56 M     0.83
     2            "int8_t variable subtract"   0.06 sec   126.98 M     0.67
     3  "int8_t multiple variable subtracts"   0.08 sec   102.56 M     0.83
     4            "int8_t variable multiply"   0.09 sec   86.02 M     0.99
     5 "int8_t multiple variable multiplies"   0.09 sec   85.11 M     1.00
     6              "int8_t variable divide"   0.06 sec   126.98 M     0.67
     7    "int8_t multiple variable divides"   0.22 sec   36.70 M     2.32
     8      "int8_t multiple variable mixed"   0.11 sec   72.73 M     1.17
     9                 "int8_t variable and"   0.05 sec   170.21 M     0.50
    10        "int8_t multiple variable and"   0.09 sec   86.02 M     0.99
    11                  "int8_t variable or"   0.05 sec   170.21 M     0.50
    12         "int8_t multiple variable or"   0.09 sec   85.11 M     1.00
    13                 "int8_t variable xor"   0.05 sec   170.21 M     0.50
    14        "int8_t multiple variable xor"   0.09 sec   85.11 M     1.00

    Total absolute time for int8_t loop invariant: 1.31 sec

    test                          description   absolute   operations   ratio with
    number                                      time       per second   test0

     0                 "uint8_t variable add"   0.06 sec   129.03 M     1.00
     1       "uint8_t multiple variable adds"   0.09 sec   85.11 M     1.52
     2            "uint8_t variable subtract"   0.06 sec   129.03 M     1.00
     3  "uint8_t multiple variable subtracts"   0.08 sec   101.27 M     1.27
     4            "uint8_t variable multiply"   0.06 sec   129.03 M     1.00
     5 "uint8_t multiple variable multiplies"   0.08 sec   102.56 M     1.26
     6              "uint8_t variable divide"   0.08 sec   102.56 M     1.26
     7    "uint8_t multiple variable divides"   0.22 sec   36.53 M     3.53
     8      "uint8_t multiple variable mixed"   0.11 sec   73.39 M     1.76
     9                 "uint8_t variable and"   0.05 sec   170.21 M     0.76
    10        "uint8_t multiple variable and"   0.09 sec   85.11 M     1.52
    11                  "uint8_t variable or"   0.08 sec   102.56 M     1.26
    12         "uint8_t multiple variable or"   0.09 sec   85.11 M     1.52
    13                 "uint8_t variable xor"   0.06 sec   129.03 M     1.00
    14        "uint8_t multiple variable xor"   0.08 sec   101.27 M     1.27

    Total absolute time for uint8_t loop invariant: 1.30 sec

    test                          description   absolute   operations   ratio with
    number                                      time       per second   test0

     0                 "int16_t variable add"   0.06 sec   129.03 M     1.00
     1       "int16_t multiple variable adds"   0.08 sec   102.56 M     1.26
     2            "int16_t variable subtract"   0.06 sec   126.98 M     1.02
     3  "int16_t multiple variable subtracts"   0.08 sec   102.56 M     1.26
     4            "int16_t variable multiply"   0.06 sec   129.03 M     1.00
     5 "int16_t multiple variable multiplies"   0.09 sec   85.11 M     1.52
     6              "int16_t variable divide"   0.06 sec   126.98 M     1.02
     7    "int16_t multiple variable divides"   0.22 sec   36.70 M     3.52
     8      "int16_t multiple variable mixed"   0.11 sec   72.73 M     1.77
     9                 "int16_t variable and"   0.06 sec   129.03 M     1.00
    10        "int16_t multiple variable and"   0.08 sec   102.56 M     1.26
    11                  "int16_t variable or"   0.06 sec   126.98 M     1.02
    12         "int16_t multiple variable or"   0.08 sec   102.56 M     1.26
    13                 "int16_t variable xor"   0.06 sec   129.03 M     1.00
    14        "int16_t multiple variable xor"   0.08 sec   101.27 M     1.27

    Total absolute time for int16_t loop invariant: 1.25 sec

    test                           description   absolute   operations   ratio with
    number                                       time       per second   test0

     0                 "uint16_t variable add"   0.06 sec   129.03 M     1.00
     1       "uint16_t multiple variable adds"   0.08 sec   102.56 M     1.26
     2            "uint16_t variable subtract"   0.06 sec   126.98 M     1.02
     3  "uint16_t multiple variable subtracts"   0.09 sec   86.02 M     1.50
     4            "uint16_t variable multiply"   0.05 sec   170.21 M     0.76
     5 "uint16_t multiple variable multiplies"   0.09 sec   85.11 M     1.52
     6              "uint16_t variable divide"   0.08 sec   102.56 M     1.26
     7    "uint16_t multiple variable divides"   0.22 sec   36.53 M     3.53
     8      "uint16_t multiple variable mixed"   0.09 sec   85.11 M     1.52
     9                 "uint16_t variable and"   0.06 sec   129.03 M     1.00
    10        "uint16_t multiple variable and"   0.08 sec   102.56 M     1.26
    11                  "uint16_t variable or"   0.06 sec   126.98 M     1.02
    12         "uint16_t multiple variable or"   0.16 sec   51.28 M     2.52
    13                 "uint16_t variable xor"   0.06 sec   126.98 M     1.02
    14        "uint16_t multiple variable xor"   0.16 sec   51.28 M     2.52

    Total absolute time for uint16_t loop invariant: 1.41 sec

    test                          description   absolute   operations   ratio with
    number                                      time       per second   test0

     0                 "int32_t variable add"   0.11 sec   73.39 M     1.00
     1       "int32_t multiple variable adds"   0.11 sec   72.73 M     1.01
     2            "int32_t variable subtract"   0.06 sec   129.03 M     0.57
     3  "int32_t multiple variable subtracts"   0.13 sec   64.00 M     1.15
     4            "int32_t variable multiply"   0.09 sec   85.11 M     0.86
     5 "int32_t multiple variable multiplies"   0.13 sec   64.00 M     1.15
     6              "int32_t variable divide"   0.06 sec   129.03 M     0.57
     7    "int32_t multiple variable divides"   0.31 sec   25.56 M     2.87
     8      "int32_t multiple variable mixed"   0.09 sec   85.11 M     0.86
     9                 "int32_t variable and"   0.06 sec   129.03 M     0.57
    10        "int32_t multiple variable and"   0.08 sec   102.56 M     0.72
    11                  "int32_t variable or"   0.06 sec   126.98 M     0.58
    12         "int32_t multiple variable or"   0.08 sec   102.56 M     0.72
    13                 "int32_t variable xor"   0.06 sec   129.03 M     0.57
    14        "int32_t multiple variable xor"   0.08 sec   101.27 M     0.72

    Total absolute time for int32_t loop invariant: 1.52 sec

    test                           description   absolute   operations   ratio with
    number                                       time       per second   test0

     0                 "uint32_t variable add"   0.06 sec   129.03 M     1.00
     1       "uint32_t multiple variable adds"   0.08 sec   102.56 M     1.26
     2            "uint32_t variable subtract"   0.06 sec   126.98 M     1.02
     3  "uint32_t multiple variable subtracts"   0.08 sec   102.56 M     1.26
     4            "uint32_t variable multiply"   0.06 sec   129.03 M     1.00
     5 "uint32_t multiple variable multiplies"   0.08 sec   102.56 M     1.26
     6              "uint32_t variable divide"   0.06 sec   126.98 M     1.02
     7    "uint32_t multiple variable divides"   0.23 sec   34.19 M     3.77
     8      "uint32_t multiple variable mixed"   0.09 sec   85.11 M     1.52
     9                 "uint32_t variable and"   0.06 sec   126.98 M     1.02
    10        "uint32_t multiple variable and"   0.08 sec   102.56 M     1.26
    11                  "uint32_t variable or"   0.06 sec   129.03 M     1.00
    12         "uint32_t multiple variable or"   0.08 sec   102.56 M     1.26
    13                 "uint32_t variable xor"   0.06 sec   126.98 M     1.02
    14        "uint32_t multiple variable xor"   0.08 sec   102.56 M     1.26

    Total absolute time for uint32_t loop invariant: 1.23 sec

    test                          description   absolute   operations   ratio with
    number                                      time       per second   test0

     0                 "int64_t variable add"   0.09 sec   85.11 M     1.00
     1       "int64_t multiple variable adds"   0.13 sec   64.00 M     1.33
     2            "int64_t variable subtract"   0.09 sec   86.02 M     0.99
     3  "int64_t multiple variable subtracts"   0.14 sec   56.74 M     1.50
     4            "int64_t variable multiply"   0.13 sec   64.00 M     1.33
     5 "int64_t multiple variable multiplies"   0.28 sec   28.47 M     2.99
     6              "int64_t variable divide"   0.23 sec   34.04 M     2.50
     7    "int64_t multiple variable divides"   0.59 sec   13.49 M     6.31
     8      "int64_t multiple variable mixed"   0.31 sec   25.56 M     3.33
     9                 "int64_t variable and"   0.08 sec   102.56 M     0.83
    10        "int64_t multiple variable and"   0.13 sec   64.00 M     1.33
    11                  "int64_t variable or"   0.09 sec   85.11 M     1.00
    12         "int64_t multiple variable or"   0.14 sec   56.74 M     1.50
    13                 "int64_t variable xor"   0.08 sec   102.56 M     0.83
    14        "int64_t multiple variable xor"   0.13 sec   64.00 M     1.33

    Total absolute time for int64_t loop invariant: 2.64 sec

    test                           description   absolute   operations   ratio with
    number                                       time       per second   test0

     0                 "uint64_t variable add"   0.09 sec   86.02 M     1.00
     1       "uint64_t multiple variable adds"   0.13 sec   64.00 M     1.34
     2            "uint64_t variable subtract"   0.09 sec   85.11 M     1.01
     3  "uint64_t multiple variable subtracts"   0.13 sec   64.00 M     1.34
     4            "uint64_t variable multiply"   0.13 sec   64.00 M     1.34
     5 "uint64_t multiple variable multiplies"   0.31 sec   25.56 M     3.37
     6              "uint64_t variable divide"   0.16 sec   51.28 M     1.68
     7    "uint64_t multiple variable divides"   0.55 sec   14.63 M     5.88
     8      "uint64_t multiple variable mixed"   0.34 sec   23.26 M     3.70
     9                 "uint64_t variable and"   0.08 sec   102.56 M     0.84
    10        "uint64_t multiple variable and"   0.13 sec   64.00 M     1.34
    11                  "uint64_t variable or"   0.09 sec   86.02 M     1.00
    12         "uint64_t multiple variable or"   0.13 sec   64.00 M     1.34
    13                 "uint64_t variable xor"   0.08 sec   101.27 M     0.85
    14        "uint64_t multiple variable xor"   0.13 sec   64.00 M     1.34

    Total absolute time for uint64_t loop invariant: 2.55 sec

    test                        description   absolute   operations   ratio with
    number                                    time       per second   test0

     0                 "float variable add"   0.08 sec   102.56 M     1.00
     1       "float multiple variable adds"   0.14 sec   57.14 M     1.79
     2            "float variable subtract"   0.08 sec   102.56 M     1.00
     3  "float multiple variable subtracts"   0.13 sec   64.00 M     1.60
     4            "float variable multiply"   0.08 sec   101.27 M     1.01
     5 "float multiple variable multiplies"   0.14 sec   57.14 M     1.79
     6              "float variable divide"   0.08 sec   102.56 M     1.00
     7    "float multiple variable divides"   0.31 sec   25.56 M     4.01
     8      "float multiple variable mixed"   0.19 sec   42.78 M     2.40

    Total absolute time for float loop invariant: 1.22 sec

    test                         description   absolute   operations   ratio with
    number                                     time       per second   test0

     0                 "double variable add"   0.09 sec   85.11 M     1.00
     1       "double multiple variable adds"   0.11 sec   73.39 M     1.16
     2            "double variable subtract"   0.09 sec   85.11 M     1.00
     3  "double multiple variable subtracts"   0.11 sec   72.73 M     1.17
     4            "double variable multiply"   0.09 sec   86.02 M     0.99
     5 "double multiple variable multiplies"   0.13 sec   64.00 M     1.33
     6              "double variable divide"   0.11 sec   72.73 M     1.17
     7    "double multiple variable divides"   0.33 sec   24.39 M     3.49
     8      "double multiple variable mixed"   0.22 sec   36.53 M     2.33

    Total absolute time for double loop invariant: 1.28 sec
    =====================================
    \cpp_performance_benchmark_msvc\Release\cpp_performance_benchmark_msvc.exe 100000

    test                        description   absolute   operations   ratio with
    number                                    time       per second   test0

     0                     "double pointer"   1.34 sec   148.81 M     1.00
     1               "double pointer_class"   4.44 sec   45.07 M     3.30
     2         "DoubleValueWrapper pointer"   4.76 sec   41.97 M     3.55
     3   "DoubleValueWrapper pointer_class"   7.06 sec   28.32 M     5.26
     4       "DoubleValueWrapper10 pointer"  28.06 sec    7.13 M     20.88
     5 "DoubleValueWrapper10 pointer_class"  31.81 sec    6.29 M     23.67

    Total absolute time for Abstraction Accumulate: 77.49 sec

    Abstraction Accumulate Penalty: 7.88


    test                                       description   absolute   operations   ratio with
    number                                                   time       per second   test0

     0                     "insertion_sort double pointer"   0.48 sec    0.21 M     1.00
     1               "insertion_sort double pointer_class"   1.36 sec    0.07 M     2.81
     2         "insertion_sort DoubleValueWrapper pointer"   0.66 sec    0.15 M     1.36
     3   "insertion_sort DoubleValueWrapper pointer_class"   1.92 sec    0.05 M     3.97
     4       "insertion_sort DoubleValueWrapper10 pointer"   2.70 sec    0.04 M     5.58
     5 "insertion_sort DoubleValueWrapper10 pointer_class"   3.45 sec    0.03 M     7.14

    Total absolute time for Abstraction Insertion Sort: 10.58 sec

    Abstraction Insertion Sort Penalty: 3.60


    test                                  description   absolute   operations   ratio with
    number                                              time       per second   test0

     0                     "quicksort double pointer"   0.17 sec    4.68 M     1.00
     1               "quicksort double pointer_class"   0.38 sec    2.13 M     2.19
     2         "quicksort DoubleValueWrapper pointer"   0.25 sec    3.20 M     1.46
     3   "quicksort DoubleValueWrapper pointer_class"   0.47 sec    1.71 M     2.74
     4       "quicksort DoubleValueWrapper10 pointer"   0.80 sec    1.00 M     4.66
     5 "quicksort DoubleValueWrapper10 pointer_class"   1.03 sec    0.78 M     6.03

    Total absolute time for Abstraction Quicksort: 3.09 sec

    Abstraction Quicksort Penalty: 3.01


    test                                  description   absolute   operations   ratio with
    number                                              time       per second   test0

     0                     "heap_sort double pointer"   0.16 sec    5.10 M     1.00
     1               "heap_sort double pointer_class"   0.61 sec    1.31 M     3.88
     2         "heap_sort DoubleValueWrapper pointer"   0.25 sec    3.20 M     1.59
     3   "heap_sort DoubleValueWrapper pointer_class"   0.73 sec    1.09 M     4.68
     4       "heap_sort DoubleValueWrapper10 pointer"   0.61 sec    1.31 M     3.89
     5 "heap_sort DoubleValueWrapper10 pointer_class"   1.05 sec    0.76 M     6.67

    Total absolute time for Abstraction Heap Sort: 3.41 sec

    Abstraction Heap Sort Penalty: 3.76
    ===========================================================================

    Is there any comment or explanation?


    Thursday, June 12, 2008 10:14 PM

Answers

  • I think the makefile Adobe provided has less than ideal optimization settings. The makefile comes with '/Ox' as the only opimization flag; changing that to '/O2 /GL /GS- /GA /arch:SSE2' improved things dramatically for me.

    In your test, MSVC performed the 'int8_t variable add' test at 85.11M operations per second, while GCC performed at 173.91M operations per second, a 1:2.043 ratio. For me, MSVC with the original makefile performed this test at 967.94M operations per second, while a makefile with better optimization flags performed at 1972.87M operations per second, a 1:2.038 ratio.

    So, presumably, MSVC with the proper optimization flags performs nearly identically to GCC (under the assumption that GCC's optimization flags cannot also be improved upon).
    • Marked as answer by Yan-Fei Wei Thursday, June 19, 2008 3:48 AM
    Friday, June 13, 2008 12:43 AM
  • Whether you used the makefile or an IDE is orthogonal to the optimization parameters supplied to the compiler. The main point was that minor changes in optimization parameters produced drastic differences in speed, and it appears that with an improved combination of optimization parameters, MSVC performs on par with GCC.
    • Marked as answer by Yan-Fei Wei Thursday, June 19, 2008 3:48 AM
    Friday, June 13, 2008 4:03 PM

All replies

  • I think the makefile Adobe provided has less than ideal optimization settings. The makefile comes with '/Ox' as the only opimization flag; changing that to '/O2 /GL /GS- /GA /arch:SSE2' improved things dramatically for me.

    In your test, MSVC performed the 'int8_t variable add' test at 85.11M operations per second, while GCC performed at 173.91M operations per second, a 1:2.043 ratio. For me, MSVC with the original makefile performed this test at 967.94M operations per second, while a makefile with better optimization flags performed at 1972.87M operations per second, a 1:2.038 ratio.

    So, presumably, MSVC with the proper optimization flags performs nearly identically to GCC (under the assumption that GCC's optimization flags cannot also be improved upon).
    • Marked as answer by Yan-Fei Wei Thursday, June 19, 2008 3:48 AM
    Friday, June 13, 2008 12:43 AM
  • Actually I did not use the provided make files, for the MSVC I just created a VC++ console application (I tested with both of favor speed optimization and the default optimization parameters). For the MinGW gcc I used eclipse similar to VC++ case. Please keep in mind the gcc version that I used was 4.3 (the most recent version) not 3.4.
    Friday, June 13, 2008 2:03 AM
  • Whether you used the makefile or an IDE is orthogonal to the optimization parameters supplied to the compiler. The main point was that minor changes in optimization parameters produced drastic differences in speed, and it appears that with an improved combination of optimization parameters, MSVC performs on par with GCC.
    • Marked as answer by Yan-Fei Wei Thursday, June 19, 2008 3:48 AM
    Friday, June 13, 2008 4:03 PM
  • Hi,

    Performance can be tuned to meet the other compiler speeds in VC++. there are several optimization can be made to tune to higher speed.

    There are several cannot be done with gcc but can be with VS2008.

     

    Monday, May 31, 2010 6:53 AM