When we have measured time smaller than target time, we are decreasing the parameters. Thus, we should first try to decrease t_cost and only if that is not possible should we try to decrease m_cost instead. The original logic was only valid for the case where parameters are being increased. Most notably this caused unusual parameter combinations for iteration time < 250 ms.
In this commit we also factor out the now heavily nested parameter update formula.