AIX xlC STL implementation is significantly slower than other platforms?

Something that takes 1 second to run on Linux takes 45 seconds to run on AIX. I didn't dug directly into this code, but grabbed a small app as a test, which is very little from another SO question:

int main ( int argc, char **argv)
{
int i = 0;
std::vector<int> vec;
vec.push_back(6);
vec.push_back(-17);
vec.push_back(12);

for (i=0;i<100000;i++)
   vec.push_back(i);

vec.erase(vec.begin() + 1);
return 0;
}

      

I have an old compiler (7.0.0.10) and I can't believe how much slower the code is against the same code in g ++ 4.2.

Has anyone seen this before? It will take some work to update the compiler. The sample code is about 20 times slower (in real time) on a system with little to no load.

Updating the specification of required fields:

    Number Of Processors: 8
    Processor Clock Speed: 3504 MHz
    CPU Type: 64-bit
    Kernel Type: 64-bit
    Memory Size: 63232 MB
    Good Memory Size: 63232 MB
    Platform Firmware level: EM340_041
    Firmware Version: IBM, EM340_041
    Console Login: enable
    Auto Restart: true
    Full Core: true

Output on AIX:

real    0m0.52s
user    0m0.51s
sys     0m0.00s

      

Output to Linux:

 0.00s real     0.01s user     0.00s system

      

+1


a source to share


3 answers


I suspect a suboptimal memory allocation strategy. What happens if you add

vec.reserve(10000);

      



before the for loop?

0


a source


Either there is something seriously wrong with your setup, or you haven't posted the actual code. The following runs almost instantaneously on a very old 900 MHz Pentium laptop with little memory:

#include <iostream>
#include <vector>
#include <ctime>
using namespace std;;

int main ( int argc, char **argv) {

    time_t now1 = time(0);
    std::vector<int> vec;
    vec.push_back(6);
    vec.push_back(-17);
    vec.push_back(12);
    for ( int i = 0; i<10000; i++) {
      vec.push_back(i);
    }

    time_t now2 = time(0);
    vec.erase(vec.begin() + 1);

    time_t now3 = time(0);
    cout << (now2 - now1) << " " << (now3 - now2)  << endl;
}

      



Run this code through both compilers and report the numbers it outputs.

+1


a source


A few tips to narrow down the problem:

  • Use the time in your program and see the system / user time, not the elapsed time. This will give you a clearer picture.
  • place a system("date")

    before each of the three original push_back statements, before the for loop, before erasing, and before returning. This will show which operation is causing the problem.
  • Tell us what equipment you use. You can have pSeries with 286 classes.

Then come back to us with hard data and we can help more.

0


a source







All Articles