As an emerging paradigm for automated debugging on software system, automatic program repair plays a more and more important role on computer development. Currently, although there are lots of approaches for automatically repairing errors, they do not work very well due to time-consuming validation especially when the faulty programs equip with some long-running test cases. To suppress the testing cost, we present the technique of function-based part-execution (FPE), by which only the key code, instead of the whole patched program, is executed. In addition, the invariant detection technique is applied to predict imminent program failure with incomplete execution. The controlled experiment on real bug in the PHP program show that our approach performs much better than the original Genprog, a state-of-the-art approach on automatic program repair.