Tell me about a time you had to optimize a piece of code because it was consuming too much memory or power.