I've been working on a Genetic Algorithm which I'd previously been compiling using g++ 4.8.1 with the arguments
CCFLAGS=-c -Wall -Ofast -fopenmp -mfpmath=sse -march=native -std=gnu++11
I wasn't using many of the features of c++11 and have a reasonable profiling system so I replaced literally 3-4 lines of code and had it compile without -std=gnu++11
CCFLAGS=-c -Wall -Ofast -fopenmp -mfpmath=sse -march=native
When I ran my profiler again, I noticed that I could see ~5% performance improvement almost everywhere, except for my sort function, which was now taking about twice as long. (It's an overloaded operator< on the object)
My questions are:
What performance differences are known between the two versions, and is it expected that c++11 would be faster in newer compilers?
I'm also expecting the fact I'm using -Ofast is playing a role, am I right in my assumption?
UPDATE:
As suggested in comments I ran the tests again using with and without -march=native
// Fast sort, slightly slower in other tests
CCFLAGS=-c -Wall -Ofast -fopenmp -mfpmath=sse -march=native -std=gnu++11
// Fast sort, slower in other tests
CCFLAGS=-c -Wall -Ofast -fopenmp -mfpmath=sse -std=gnu++11
// Slow sort, slower in other tests
CCFLAGS=-c -Wall -Ofast -fopenmp -mfpmath=sse
// Slow sort, fastest in other tests
CCFLAGS=-c -Wall -Ofast -fopenmp -mfpmath=sse -march=native
The conclusion seems to be the same that -std=gnu++11 speeds up sort drastically with a slight penalty almost everywhere else. -march=native speeds up program whenever used.
Given that sort is only called once per generation, I'll take the speed benefit of not compiling with -std=gnu++11, but I'm still very interested in what is causing these results.
I'm using the // std::sort provided from #include