Performance problems after porting to VS 2005 from 2003, native C++ code vs STL.

After porting code from studio 7.1 to 8.0 beta 2, performance (function execution time) decreesed twice. In each two cases code was compiled with max speed optimisation. I tried each useful in my case compiler feature for increasing performance, and nothing helps, 7.1 still x2 faster. Code use basic STL tamplates such as vector, map, iterators, heap functions and nothing else.

Please help to understand this fenomenal.   


Answer this question

Performance problems after porting to VS 2005 from 2003, native C++ code vs STL.

  • Joe Beam

    Thanks a lot Maks for taking the time to report the issue.

    I can see your bug link at http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx feedbackid=f37af40d-e3c4-4a5c-a1f7-035895b5a8de.

    Please keep an eye on the link for future updates.

    Once more, it is great to have such feedback.

    Thanks,
      Ayman Shoukry
      VC++ Team

  • Victor_123

    Thank you a lot for quick answer. I reported problem to your team as you asked. I didn't sent my code, because it will take a lot of time to make stand alone app. I used supplied in MSDN sample for push_heap function. And I saw the same problem, I acheaved 11 ms in 7.1 and 23 ms in 8.0.< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

    Here is a simple code:


    int
    _tmain(int argc, _TCHAR* argv[]) {

    using namespace std;
    vector <int> v1, v2;
    vector <int>::iterator Iter1, Iter2;

    int i;

    CTimeCount timer;
    timer.Start();
    //Here I started my timer

    for ( i = 1 ; i <= 99999; i++ )
       v1.push_back( i );

    random_shuffle( v1.begin( ), v1.end( ) );

    int sum = 0;

    for ( Iter1 = v1.begin( ) ; Iter1 != v1.end( ) ; Iter1++ )
       sum += *Iter1;

    // Make v1 a heap with default less than ordering

    make_heap ( v1.begin( ), v1.end( ) );

    for ( Iter1 = v1.begin( ) ; Iter1 != v1.end( ) ; Iter1++ )
       sum += *Iter1;

    // Add an element to the heap

    v1.push_back( 10 );

    for ( Iter1 = v1.begin( ) ; Iter1 != v1.end( ) ; Iter1++ )
       sum += *Iter1;

    push_heap( v1.begin( ), v1.end( ) );

    for ( Iter1 = v1.begin( ) ; Iter1 != v1.end( ) ; Iter1++ )
       sum += *Iter1;

    // Make v1 a heap with greater than ordering

    make_heap ( v1.begin( ), v1.end( ), greater<int>( ) );

    for ( Iter1 = v1.begin( ) ; Iter1 != v1.end( ) ; Iter1++ )
       sum += *Iter1;

    v1.push_back(0);

    for ( Iter1 = v1.begin( ) ; Iter1 != v1.end( ) ; Iter1++ )
       sum += *Iter1;

    push_heap( v1.begin( ), v1.end( ), greater<int>( ) );

    for ( Iter1 = v1.begin( ) ; Iter1 != v1.end( ) ; Iter1++ )   
       sum += *Iter1;

    timer.Stop(); // and here the checked code ends

    cout << sum << "\n";

    cout << "Test Time:" << timer.GetElapsed() << "\n";

    return 0;

    }


  • Anders Edstr&amp;#246;m

    Hi Maks,
     It would be great if you can log the perfromance issue at http://lab.msdn.microsoft.com/productfeedback/default.aspx. Please include a sample project reproducing the issue.

    Also, after you log the issue please post the link here and I will make sure the reponsible folks take a look at it.

    In addition, if you have msdn subscription, try using the latest CTP builds there.

    Thanks in advance for taking the time to report the issue.

    Thanks,
      Ayman Shoukry
      VC++ Team

  • Performance problems after porting to VS 2005 from 2003, native C++ code vs STL.