Unreal Engine 5 profiling by an AI agent: 3 FPS to 90 FPS
2:48
A level runs at 3 FPS. The agent presses Play, records a trace with Unreal's own profiler, and follows the time down to one Blueprint. Then it fixes it and measures again: about 90 FPS. The level was made slow on purpose, and the agent was not told where the problem was.
- 1The prompt gives only the symptom: the game feels slow, find out why, real numbers, no guessing, fix nothing yet. The agent presses Play on its own and records a 30 second trace. One frame takes 312 ms, and the game thread uses 310 of them. So it is game logic, not graphics. The graphics card works for only 3% of the frame.
- 2It follows that time down to one Blueprint, BP_MarketVisitor. Its Event Tick takes 301 of the 312 ms. 60 visitors each collect all 1,701 static meshes in the level and loop over them on every frame, which is 102,060 loop steps per frame, and the result is never used. It checks its own numbers, and it presses Play again with nothing recording, to confirm the profiler was not the slow part.
- 3Asked for a fix that keeps the same result, it moves the heavy loops from Event Tick to BeginPlay, so they run once. It measures again: one frame goes from 304 ms to 10.6 ms. It reads the list from a live visitor during Play to check the result is the same, and it names the one trade off: the list is now built once, at the start.