Speeding up OMNeT++/MiXiM simulations
Compiler optimisation flags can be quite helpful in bringing the (sometimes huge) duration of your OMNeT++ simulations to an acceptable level. Using a compute cluster can help, but even then the execution of a single process can take many hours for large networks. So let’s look at how you compile your code; I got a speed-up of approximately 10 times on some of my simulations.
GCC Compiler optimisation options
-O0 (default)
-O1 (some optimisation)
-O2 (heavy optimisation, longer compilation time and memory usage)
-O3 (optimise even more)
-Os optimise for size of the resulting executable (useful for devices with limited resources, highly unlikely you want to run your simulator on one of these 😉
How to get it done
The simplest way is to edit MiXiM’s makemakefiles, simply change “CONFIGNAME = gcc-debug” to “CONFIGNAME = gcc-release”, this will then use the compilerflags -O2 -DNDEBUG=1.
A more involved way is to set flags separately in OMNeT++’s configure.user or Makefile.inc, but the above approach worked for me.