Varying performance of MSVC release exe

Posted by Andrew on Stack Overflow See other posts from Stack Overflow or by Andrew
Published on 2010-04-02T06:36:57Z Indexed on 2010/04/02 6:43 UTC
Read the original article Hit count: 346

Filed under:
|
|

Hello everyone,

I am curious what could be the reason for highly varying performance of the same executable. Sometimes, I run it and it takes 20 seconds and sometimes it is 110. Source is compiled with MSVC in Release mode with standard options.

The code is here:

vector<double> Un;
vector<double> Ucur;
double *pUn, *pUcur;
...
// time marching
for (old_time=time-logfreq, time+=dt; time <= end_time; time+=dt)
  {
    for (i=1, j=Un.size()-1, pUn=&Un[1], pUcur=&Ucur[1]; i < j; ++i, ++pUn, ++pUcur)
      {
        *pUcur = (*pUn)*(1.0-0.5*alpha*( *(pUn+1) - *(pUn-1) ));
      }
    Ucur[0] = (Un[0])*(1.0-0.5*alpha*( Un[1] - Un[j]   ));
    Ucur[j] = (Un[j])*(1.0-0.5*alpha*( Un[0] - Un[j-1] ));
    Un = Ucur;
  }

© Stack Overflow or respective owner

Related posts about c++

Related posts about Performance