Maximize performance
The compiler has the ability to optimize your code at the cost of longer compile times and more obfuscated machine code. Obfuscated machine code doesn't really matter unless you want to debug, and that is the reason you should never add optimization flags to debug builds. The below flags should only affect your release builds.
To enable this in Qt Creator, add the following to your .pro file:
release { DEFINES += ARMA_NO_DEBUG QMAKE_CXXFLAGS_RELEASE -= -O2 QMAKE_CXXFLAGS_RELEASE += -O3 }
This removes the default -O1 and -O2 optimization flags and introduces the -O3 optimization flag. The difference is not large, but still useful.
Enable C++11 features
C++ has evolved with time and the new features of C++ as of 2011 are awesome. To enable them, add the following to your .pro file:
COMMON_CXXFLAGS = -std=c++0x QMAKE_CXXFLAGS += $$COMMON_CXXFLAGS QMAKE_CXXFLAGS_RELEASE += $$COMMON_CXXFLAGS QMAKE_CXXFLAGS_DEBUG += $$COMMON_CXXFLAGS
One useful feature is the optimized for-loop with a new "for each" syntax:
for(Atom* atom : atoms) { atom->calculateForce(); }
This both runs faster than many (not-correctly-implemented) for-loops that you write by hand and is easier to read.
Another are lambda functions that let you write functions directly where you need them without declaring a whole new function. In addition we get initializer lists, allowing you to write
vec a = {1, 2, 8, 3, 4, 7};
to initialize your vector a.
MPI flags
To use MPI in Qt Creator, see this blog post.