First try the profiler. By adding "const &" in certain place and changing one constant you can save about 30% of the CPU time.