SOAP: Enhancing Efficiency of Generated Code via Self-Optimization