this question is derived from that post.
it seems that the online compiler discard this function while optimizing.
void functiona()
{
long long number = 0;
// long long problemSize = 100000000000;
long long problemSize = 10;
for( long long i = 0; i < problemSize; ++i )
{
for(long long j = 0; j < problemSize; j++)
{
for(long long k = 0; k < problemSize; k++)
{
for(long long l = 0; l < problemSize; l++)
{
for(long long l = 0; l < problemSize; l++)
{
number++;
number--;
}
}
}
}
}
}
compiling this piece of code on my local mac
clang++ -std=c++11 -stdlib=libc++ benchmark.cpp
./a.out
409
seems to be without optimization.
this post and doc provide some info about clang optimization.
is there a way to enable optimization for clang++, so that the local output is close to online one.