There’s a time and a place for this and it’s not at the beginning.
Before you spend time optimizing code, make sure it would be worth it. If the program is already fast enough, then any time spent optimizing is wasted time that would be better spent building new features. Furthermore, you run the risk of introducing new bugs and adding code complexity.
So before optimizing it is important to measure performance and do some analysis. A task that takes 120 ms to complete is no big deal – unless that task needs to run thousands of time an hour.
You should prefer simplicity over efficiency until you have performance problems. Simple code is so much easier to maintain and expand. Optimization techniques involve complex algorithms, multiple levels of caching, and other tricks. The problem with clever code is that the more “interesting” it gets, the more of a maintenance headache it becomes.
That said, don’t write code that results in N+1 queries to the database. It’s not that hard to write queries correctly. And when the performance of the system becomes a problem, go ahead and optimize.