Code RoomSwiftUI scroll stutter
MediumPrep Room Coding #4208

SwiftUI scroll stutter

Vibe & agenticConcurrencyMid–Senior~16 min

An AI wrote this SwiftUI image thumbnail that downsamples a large photo before display. It works, but scrolling a grid of these stutters badly and the watchdog occasionally kills the app on launch when many cells appear at once. What's wrong and how would you fix it?

Implement
main_thread_render_cost(cell_urls: list[str], layout_passes: int, load_ms: int, decode_ms: int, work_in_body: bool, watchdog_limit_ms: int) → list[int]
Examples
in[["a.jpg","b.jpg","c.jpg"],3,40,25,true,5000]out[585,9,0]
in[["a.jpg","b.jpg","c.jpg"],3,40,25,false,5000]out[0,3,0]
in[["a.jpg"],1,3000,2000,true,5000]out[5000,1,1]
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.

0:00 of about 16 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.