When performance matters, set explicit constraints:
"You are optimizing for a system with MB RAM. Priorities: space complexity over time complexity. Avoid creating intermediate objects. Use generators instead of lists where possible. Profile every allocation."
Without these constraints, the AI optimizes for readability by default. Explicit constraints shift its priorities.