The optimization is generally recommended to leave until the end of the process of development, since the premature optimization can introduce new errors (generally more difficult to detect for being of algorithmic nature).