What are the best practices for optimizing code performance in software development?