Godot performance and release
Target: Godot 4.7.2.stable, macOS Apple Silicon; the Android helpers also run on Windows and Linux.
Expert level here means every claim about speed comes with a before and after number from the same
harness, every build is verified as a file before anyone calls it shipped, and the agent knows which
numbers Godot reports wrongly. The stance: measure, classify the bound, fix the biggest cost,
re-measure, compare pictures, then ship builds you have opened, run and listed. If a sibling skill
named here is missing from your available skills, load it with skill_get (Scenario MCP) or ask the
user to install it (https://github.com/scenario-labs/skills#install); unattended, proceed from tool
schemas and flag the gap.
REQUIRED BACKGROUND: scenario-godot-expert (channels, the review loop, toolkit, 4.7 traps).
Stance (the expert delta)
- Classify before fixing. Frame time is the slower of CPU and GPU, so a fix on the other side
gains nothing (general optimization doc). Live: cutting draw calls from 2,501 to 2 dropped CPU
from 2.7 to 0.35 ms and left the GPU at 6.2 ms; only the shadow budget moved the GPU (to 1.7 ms).
Run a half-resolution pass: when GPU time does not fall, resolution is not the problem [added].
First log RenderingServer.get_video_adapter_name(): a hybrid laptop may run on its integrated
GPU; --gpu-index N picks another [added].
- Nodes cost before pixels do. Per-node
_process, thousands of nodes and redundant physics
objects are the usual Godot CPU cost (Firebelley 1PnG3r1rKcs: 115 ms to about 8 ms with
RenderingServer items; DwMoEdAhtYQ, O5a4AKemkiQ). Replace repeats with MultiMesh and a shader,
and centralize ticking. Live: 2,000 MeshInstance3D created in 2.3 ms, 0.6 ms through
RenderingServer.instance_create2.
- Spread periodic work. Random phase per poller,
force_raycast_update()on a disabled RayCast
(Dan Does Dev, s2C2RO_WMh0 [00:05:34]). Live: 600 agents, worst tick 1.93 to 0.64 ms, spike
frames 62 to 16.
- Hand-sized occluders, judged by objects drawn. Box occluders per big wall beat a whole-scene
bake (Zenva, VBiBZBVxu1s: about 300 to 80 FPS baked versus 350 with boxes). Occlusion is a CPU
raster: judge by objects drawn from several camera spots.
- Hitches are loading, pipelines and runtime bakes. Load AND instantiate off the main thread,
ship a warm pipeline cache (Shader Baker export option, 4.5), and log the
PIPELINE_COMPILATIONS_* deltas per frame so each hitch is classed as load or compile. Navmesh
bakes and ReflectionProbes on Always at area boundaries are the other suspects [added]. Live
worst frame: synchronous 453 ms cold, threaded load plus instantiate 230 ms cold, 9.6 ms warm.
- Test on the real target, long enough. Export With Debug does not slow the game; throttling
shows only on long runs (Ian Bolton, Arm, WrjaUNAXYqk [00:05:20, 00:09:35]). Soak a phone 30
minutes in the heaviest area and gate on minutes 20 to 30 [added duration]. Clean build for every
perf report: a stale cache hid a perf bug for weeks (Claire Blackshaw, grdqHJOL5F4 [00:16:15]).
- Exports fail on environment and credentials, not on Godot. Templates per exact version, JDK
and SDK paths, ETC2/ASTC import, bundle ids, signing identities, server headers. Credentials go
in GODOT_* env vars, never in export_presets.cfg (export docs; Nihamkin _n9l15CANag
[00:25:38]).
- Web is Compatibility only and single-threaded by default. Threads need COOP
same-origin
plus COEP require-corp over HTTPS (web doc). Live: the threaded build without headers does not
start.
- A written plan must run without this toolkit. Next to every
gd_perfcall, give the engine
code or CLI it wraps: the logger below, godot --headless --export-release, the env vars,
bundletool, xcodebuild. Round-1 blind grading docked plans a reader could not run.
Establish first
| Input | Why it changes the plan | Default if unknown |
| -------------------------------- | --------------------------------------------------------------------- | -------------------------------------------------------- |
| Target hardware and frame budget | 16.67 ms at 60 fps, 33.33 at 30, 11.11 at 90 (VR), 8.33 at 120 | 60 fps on the lowest named device |
| Renderer per platform | auto-instancing, occlusion, features differ; web forces Compatibility | Forward+ desktop, Mobile on phones, Compatibility on web |
| Where it is slow | steady low fps versus hitches when loading or turning | profile both |
| Platforms and stores | signing, ids, size limits, AAB versus APK | ask; each store needs account steps |
| Download budget | wasm, pck, APK sizes | the bytes the host really serves |
| Who holds credentials | keystores, Apple team, Steam builder | the agent never invents or stores secrets |
Workflow
- Baseline on a clean project copy. Clone with
gd_env.base_project,gd_perf.install(P),
rename application/config/name (Base3D clones otherwise share one user:// and shader cache).
Read project.godot back: Jolt for 3D, the renderer you mean. gd_perf.scene_audit on the heavy
scene. GATE: audit JSON saved, physics engine and renderer confirmed.
- Measure windowed, per variable.
gd_perf.profile_variant(P, scene, size=(1280, 720), driver="vulkan"): per-frame CSV, visible
and shadow draw calls, scene _process time from sentinel nodes; it compares settings,
toggles or rendering_method variants after gd_perf.install(P), while a single verdict on an
unchanged scene needs only the lead's gd_run.profile_scene(driver="vulkan"). Never use
Performance.TIME_PROCESS per frame: it holds one value for about a second. Metal reports GPU 0
on macOS; use Vulkan. Windowed frame time is capped at the refresh; judge gpu_ms and cpu_ms.
Deeper: --gpu-profile, the Visual Profiler, the script Profiler (read Self, not Inclusive; it
does not cover C#), RenderDoc or the vendor tool for one frame. GATE: two runs within 10 %
[added].
- Classify.
gd_perf.classify(full, half_res). GATE: a written verdict (CPU scripts, CPU
render, GPU fill, GPU geometry or shadows) backed by numbers.
- Fix one thing, re-measure, look.
gd_perf.apply_fix(P, scene, out, fix)writes a new scene:
share_materials, multimesh, shadow_budget, box_occluders, visibility_range,
strip_process (lab only: drops _process scripts once a shader does their work).
gd_perf.compare(before, after) applies a 5 % and 0.1 ms noise floor. Capture before and after,
contact sheet, open it. Resolution scale below an agreed floor (0.67) needs sign-off [added].
GATE: metric improved beyond noise, nothing regressed, mean luma difference under 0.02 or the
change approved.
- Hitch pass.
perf_bench.gd:hitchwith a freshprivate_home(run withhome_env) for a
cold shader cache. GATE: worst frame under 2x the budget on warm cache, pipeline compilations off
gameplay frames.
- Ship builds. Presets through
gd_run.ensure_presetplusgd_perf.preset_fields; exports
under gd_perf.export_env(**gd_perf.home_env(home)) with home = gd_perf.private_home(...).
Plain CLI: godot --headless --path . --export-release "<preset>" <out>. Verify each artifact:
verify_macos, verify_apk, verify_xcode_project, pck_listing, size_report, web_smoke.
GATE: per platform below.
- Run what you exported.
gd_perf.run_exported(exe, ["--headless", "--", "--perf-log", "--perf-quit"]) with