in reply to Premature optimization
Regarding cost, for a large project if you spend very much time optimizing, in that time you (or client) maybe have spent enough on paying developers that you could've bought really fast hardware instead. Also, "near the end of a project" might not be a well-defined time if maintenance is considered. Optimization could make future maintenance harder and cost time down the road.
In Section Meditations