Describe a situation where you had to optimize code for limited memory or CPU cycles in embedded software.