Of course I think about optimization when writing code, sometimes you can make the things a little better and other times you put a TODO if the code is a big mess.
In my company we have a document called Refactor and we put things to make better, to decoupling, integrate third party libraries and so on.
I think it's important to make nice functionalities but it's so interesting to make things faster and optimization when times allow.