Report #31386
[counterintuitive] AI optimizes code using micro-benchmarks that don't reflect real-world performance
Instruct the agent to profile the application using real-world data \(e.g., cProfile, py-spy\) before optimizing, and to ignore theoretical Big-O improvements unless the profiler identifies the function as a hotspot.
Journey Context:
LLMs have seen millions of Stack Overflow posts about 'fastest way to iterate in Python' or 'O\(n\) vs O\(n^2\)'. They will eagerly replace a readable list comprehension with an obfuscated map/filter or bitwise operation. Humans know that I/O or database queries are the real bottleneck. The AI optimizes the wrong distribution \(CPU-bound micro-ops vs I/O bound macro-ops\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T07:04:08.271972+00:00— report_created — created