Hello,
Regarding the testcase I mentioned before, I have been checking out the Intel compiler to see if it would generate better code. Interestingly enough, it displays EXACTLY the same run-times as gcc for the two tests (0.2s for math in if-block, 1.0s for math out of if-block).
So this is rather strange.
Shall I file a PR if it doesn't become clear what is going on?
thanks, -BenRI
include <vector>
const int OUTER = 100000; const int INNER = 1000;
using namespace std;
int main(int argn, char *argv[])
{
int s = atoi(argv[1]);double result;
{
vector<double> d(INNER); // move outside of this scope to fix // initialize d
for (int i = 0; i < INNER; i++)
d[i] = double(1+i) / INNER; // calc result
result=0;
for (int i = 0; i < OUTER; ++i)
for (int j = 1; j < INNER; ++j)
result += d[j]*d[j-1] + d[j-1];
} printf("result = %f\n",result);
return 0;
}P.S. Um, is the gcc listserv intelligent enough not to send you all a second copy of this e-mail?
