# Loops that blow up with big data

Prompt · Performance and scale · P06

Finds loops inside loops that are fine at 50 rows and painful at 50,000.

## Prompt

```text
Identify potentially quadratic or worse operations in frequently used code paths, including nested joins in application memory, copy-on-every-iteration patterns and repeated scans. Determine realistic input sizes and benchmark the highest-impact candidates before changing their algorithms.
```

**What it returns:** Each candidate with realistic input size and a benchmark at that size; ignore candidates whose real inputs stay small.

**Skip it when:** Code whose inputs are small and capped by design.

**Tools:** A speed-test setup. The experimental agent-complexity-optimizer scanner can suggest places to look.

**Watch for:** Static scanners flag nested loops over tiny arrays. Without real sizes the list is mostly noise.

**Changes:** Changes nothing

**Sessions:** One session

## Related

- [Queries that grow badly](https://www.atlasscope.dev/prompts/queries-that-grow-badly): Finds the database queries that will be the first to slow down as tables grow.
- [Reproduce, measure, prove](https://www.atlasscope.dev/prompts/reproduce-measure-prove)

Source: https://www.atlasscope.dev/prompts/loops-that-blow-up-with-big-data
