Optimize the execution of exec2().