Performance and memory
performanceDiagnose why a Roblox place is heavy by reading frame, memory, draw-call, script-CPU, coverage, scene, and broken-asset data, then profile running scripts and capture frame spikes.
Instructions
Reads the engine's own counters, and can run the script profiler.
snapshot returns what the Developer Console shows: frame, physics and render times in milliseconds, instance and part counts, draw calls, network rates, and memory broken down by category. Use it to answer 'why is this place heavy' with numbers instead of guesses.
profile runs Studio's script profiler — the Script Performance window — for seconds and reports which scripts consumed CPU. It blocks for that long, so keep it short. It only sees code that actually runs, so start a playtest first; profiling an idle edit session returns nothing.
microprofile is the MicroProfiler: it captures the last frames frames and ranks the engine scopes that filled them — physics, rendering, replication, GC, scripts — by self time, on every CPU thread, plus frame time p50/p95/max and what filled the worst frame. Use it for a frame-time spike that profile cannot explain, because most spikes are not Luau. The profiler is process-wide, so in Studio it includes Studio's own UI work; play first to measure the game. export saves the capture as an .x.html file the MicroProfiler viewer opens. Same frames, compared before and after a change, is the way to prove a fix.
coverage reports which lines of which scripts actually executed — dead code, untested branches, whether a fix was even reached. Pass enable first, then play, then read the coverage back FROM THE PLAYTEST session, not the editor: instrumenting is per data model, and the playtest is a different one. enable is remembered for the place and re-applied by each new session as it loads. Pass an empty enable array to stop.
What it can and cannot see: instrumentation is fixed when a script is first compiled, so it measures modules required after that point — where most game logic lives — but never a script that starts with the place, which the data model compiles before any plugin exists. Those report 0 lines and are named as unmeasurable rather than counted as dead code.
scene breaks the place down by what it is actually made of: instances by category, triangles and draw calls FOR WHAT THE CAMERA CAN SEE, and the assets holding script, animation and audio memory — each named, so "2.4GB of memory" becomes "this animation is 138KB and these are the Animators using it". It also reports UNPARENTED INSTANCES, which is the closest thing here to a leak detector: objects still alive with nothing holding them in the tree, invisible to find and to tree because they are in neither.
The triangle and draw-call section is the one number here that depends on where the camera is pointing, and it moves enormously: the same place measured 332 triangles looking at empty sky and 29,060 looking at 1,800 parts, seconds apart. So it answers "how heavy is this view", not "how heavy is this place" — point the camera first with viewport op="focus", and compare two views only if both were framed the same way.
audit is a health check rather than a performance one: it finds every reference in the place that points at NOTHING. A Sound whose id was deleted or made private plays silence, a Decal shows nothing, an Animation does nothing — none of them errors, none warns, and the instance looks perfectly healthy because the id is still a string. The only other way to find them is to play the game and notice something missing. It also reports ids left blank, scripts left Disabled, and same-named siblings, which is what makes WaitForChild return the wrong one.
audit fetches the assets to test them, so Studio's Output window will show load errors for the dead ones. That is the engine confirming the finding, not a fault in the tool.
Frame and network figures are only meaningful while something is running. Instance counts and memory are useful in edit mode too.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "performance"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| op | No | 'snapshot' reads counters now; 'profile' samples running scripts; 'microprofile' captures MicroProfiler frames (engine scopes on every thread); 'coverage' reports which lines have executed; 'scene' breaks the place down by what it is made of; 'audit' finds broken asset references and other silent faults. | snapshot |
| top | No | microprofile only: scopes to list. | |
| sort | No | microprofile only: rank by self time (where work happened) or total (including children). | self |
| enable | No | coverage only: scripts to start measuring. Remembered for this place and switched on by every session that loads afterwards, so a playtest instruments them before its scripts run. An empty array stops instrumenting. | |
| export | No | microprofile only: also save the capture as an .x.html file and return its path. | |
| filter | No | microprofile only: keep scopes whose name or group contains this, e.g. "Physics" or "Script". | |
| frames | No | microprofile only: how many recent frames to capture. | |
| player | No | client only: player name; required with multiple players. | |
| target | No | client: read the actual player's playtest VM. Use the playtest server studioId. | studio |
| thread | No | microprofile only: walk only threads whose name contains this, e.g. "RBX Main". | |
| seconds | No | profile only: how long to sample. The call blocks for this long. | |
| section | No | scene only: return just one section instead of all six. | |
| studioId | No | Target Studio; omit for the active one. | |
| frequency | No | profile only: samples per second. Higher is more precise and costlier. | |
| includeIdle | No | microprofile only: keep Sleep/Wait scopes, hidden by default because they are the absence of work. | |
| keepRunning | No | microprofile only: leave the MicroProfiler on afterwards instead of switching it off. | |
| includePlugins | No | profile only: include Studio plugins in the results. Off by default — an idle Studio is mostly plugin activity, which buries the place's own scripts. |