Optimize loop performance

Optimize loop performance in JavaScript — with the four heights of help laid out: do it now, make it easier for the next person to accept, work out the right move when you are stuck, and learn the pattern so it stops coming back.

4prompt heights
Open it in the interactive atlas →

The four heights

The same task, four distances: today's deadline, the next reviewer, the stuck moment, the pattern.

Execute — do the immediate task

+
A hot loop in the rendering path is causing frame drops; optimize the loop that builds the virtual…
A hot loop in the rendering path is causing frame drops; optimize the loop that builds the virtual list by removing unnecessary allocations, hoisting invariant calculations, and using indexed access rather than repeated property lookups. Ensure the change keeps identical output and cut per-iteration work so the 1000-item render drops from 120ms to under 40ms.

Improve — make it easier to accept

+
Before I submit the loop change to reviewers, make the optimization clear and safe: show the…
Before I submit the loop change to reviewers, make the optimization clear and safe: show the current per-iteration cost and the proposed lowered cost, surface which expressions were hoisted or memoized, highlight any changes that affect mutation order, and flag tests that should be added to guard against subtle state bugs. Recommend ways to measure the improvement in CI.

Decide — diagnose the stuck moment

+
I replaced a helper with a more expressive one and now the 500-item list render doubled in time;…

A loop in list rendering just became the slow path

I replaced a helper with a more expressive one and now the 500-item list render doubled in time; the hot spot seems to be a loop that allocates objects each iteration. I cannot tell whether eliminating allocations or changing the loop form will help more. Which quick experiment will give the clearest signal and how should I measure it?

Become — change the pattern

+
I repeatedly ship code where naive loops cause regressions in medium-size datasets, and each fix…

Repeated loop inefficiencies across features

I repeatedly ship code where naive loops cause regressions in medium-size datasets, and each fix takes an afternoon. Where am I most likely being sloppy — micro-allocation, property access, or algorithm choice — and what single coding habit change will prevent these loop problems in future reviews?

Next to this one

Other programming language work people do in JavaScript.

Every task here came from the work, not from a feature list — which is why the prompts name what you want done and never the button that does it. The tool changes; the work does not.
Copyright © LLOS.ai · 2026 — original pedagogy, voice, and design — all rights reserved.

The rest of the map

Same library, five ways in.