Overengineering adds complexity, patterns, or functionality beyond what a system needs. In performance work, an optimization can make code or infrastructure harder to maintain without improving the overall workflow—especially when traffic and latency requirements are unknown. section 2.7.2 section 7.1
LLM-generated code creates a tension between inferring too little and inferring too much. Useful inference can preserve backward compatibility and handle edge cases; excessive inference can introduce unnecessary patterns or imagined business functionality. Give the model relevant context and explicitly constrain its scope when precision matters. section 2.7.2
Figure 2.7 LLM inferring too much vs too little.

The inference spectrum contrasts missing context with unnecessary assumptions and engineering. section 2.7.2
Premature concurrency in account lookup
A prompt instructed an LLM to move away from a single-threaded account lookup. The result included four concurrent strategies and assumed a large input size without asking. Its custom benchmark used 100,000 accounts, although 10,000 better reflected the expected workload. The benchmark itself had potential measurement problems, including inadequate warmup, so its results required scrutiny. section 7.1.2
Keep complexity accountable to the requirement:
- Start with maintainable code when performance requirements or traffic data are missing; an upfront optimization may target a path that does not affect the main workflow. section 7.1
- State expected workload and scope in the prompt. Ask the LLM not to enhance code based on unstated assumptions when that would add unnecessary work. section 2.7.2 section 7.5
- Measure before changing production code, provide the measured numbers to the LLM, and focus optimization on the relevant hot path. Broad changes and excessive metrics increase review or analysis effort. section 7.5
- Scrutinize generated benchmarks as well as generated code. For Java performance measurements, the custom benchmark example motivates using JMH rather than relying on potentially misleading timing code. section 7.1.2


