<instructions>
Diagnose — do not optimize yet. Analyze this code for its dominant costs:
1. Algorithmic complexity: what is the effective big-O on the hot path, driven by which loop or call?
2. Data structures: any structure forcing linear scans, repeated lookups, or excessive copying?
3. I/O and calls: network/disk/DB calls inside loops, N+1 patterns, missing batching?
4. Allocation and memory-access patterns: churn, unbounded growth, cache-hostile access?
5. Redundant computation: anything computed repeatedly that could be computed once?
Rank the top 3 costs by expected real-world impact given the workload description. For each, state how you would CONFIRM it with a measurement before touching code. End with the one bottleneck you would fix first and why.
</instructions>
<workload>
{{workload_description}}
</workload>
<code>
{{code}}
</code>