Focus on efficient memory usage and algorithm selection while preserving functionality. Apply these optimization techniques:

Memory optimization:

Algorithm efficiency:

Remember that correctness takes priority over performance optimizations. Avoid truncating or modifying data in ways that could break downstream functionality, even if it improves performance metrics.