harvest/benchmarks/REPORT.md
2026-10-03 12:14:28 -04:00

109 lines
8.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Performance report
Measured 2026-10-02 on a single machine. These are measurements of this build on this hardware,
not guarantees; minimum hardware is not defined.
## Test system
| | |
|---|---|
| CPU | AMD Ryzen 7 7800X3D (8 cores / 16 threads) |
| GPU | AMD Radeon RX 7900 XT (RADV NAVI31), Vulkan 1.4.354, Mesa 26.2.3 |
| RAM | 30 GB |
| OS | Arch Linux, kernel 7.1.8, labwc (Wayland) — Godot ran as an X11 client (XWayland) |
| Display | 1920 × 1080 @ 180 Hz primary; benchmarks fullscreen on it (window and viewport 1920 × 1080) |
| Engine | Godot 4.7.2-stable (official, ed1daf0bf), **editor binary running the project** |
| Build | **Not a release build** (no export templates installed; `OS.is_debug_build()` = true) |
| Renderer | Mobile (Vulkan), MSAA 3D 2×, directional shadows on (birds/bullets cast none) |
| Physics | Jolt, 60 Hz, physics interpolation on |
## Method
* `benchmarks/run_benchmarks.sh` runs every preset fullscreen with the same seed (20261002) and
the same scripted player: a closed route (SPREAD) or a held point (CONCENTRATED: open center;
BOTTLENECK: inside the two-wall corridor), aim sweeping at 1.3 rad/s, continuous fire.
* 10 s warm-up, then 60 s capture (30 s for the VSync-on checks). Frame time = wall time between
`_process` calls; simulation time = one `RoundController.sim_tick`; GPU / CPU render time from
`RenderingServer.viewport_get_measured_render_time_*`; draw calls from `get_rendering_info`.
The overlay is off during measurement; timing collection is always on and costs a few
`Time.get_ticks_usec()` reads per tick.
* **All presets are labeled stress configurations**: the player is invulnerable (attacks are
still evaluated and absorbed hits counted) and killed birds are recycled to keep the preset
population. Collision, melee, navigation, and projectile sweeps are fully enabled — no result
here is a partial-system diagnostic.
* Camera framing: the fixed camera frames the whole arena, so every active bird is on screen
(ortho size 30.5 m compact, 58.8 m enlarged). Enlarged = the same layout scaled 2× in XZ
(64 × 64 m) for representative density; compact 1,000/2,000 runs are congestion tests with
documented soft overlap (birds compress against each other and the player).
* VSync off measures uncapped throughput; VSync on checks playability at the display's 180 Hz.
## Results
| run | birds | layout | vsync | frames | mean ms | p95 ms | p99 ms | max ms | >16.7 ms | sim p95 ms | GPU p95 ms | draw calls | p95 <= 16.67 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| normal25_compact_spread | 25 | COMPACT | disabled | 198435 | 0.30 | 0.36 | 0.68 | 2.60 | 0 | 0.96 | 0.11 | 113 | PASS |
| normal50_compact_spread | 50 | COMPACT | disabled | 198585 | 0.30 | 0.35 | 0.73 | 3.41 | 0 | 0.96 | 0.11 | 113 | PASS |
| stress250_compact_spread | 250 | COMPACT | disabled | 192110 | 0.31 | 0.35 | 1.32 | 4.78 | 0 | 1.61 | 0.12 | 113 | PASS |
| stress500_compact_spread | 500 | COMPACT | disabled | 181556 | 0.33 | 0.35 | 2.21 | 5.34 | 0 | 2.24 | 0.14 | 113 | PASS |
| stress1000_enlarged_spread | 1000 | ENLARGED | disabled | 158072 | 0.38 | 0.34 | 4.05 | 6.29 | 0 | 3.81 | 0.17 | 118 | PASS |
| stress2000_enlarged_spread | 2000 | ENLARGED | disabled | 118129 | 0.51 | 0.44 | 6.70 | 8.40 | 0 | 6.70 | 0.28 | 118 | PASS |
| stress2000_enlarged_concentrated | 2000 | ENLARGED | disabled | 137329 | 0.44 | 0.36 | 5.44 | 7.44 | 0 | 5.89 | 0.22 | 118 | PASS |
| stress2000_enlarged_bottleneck | 2000 | ENLARGED | disabled | 115498 | 0.52 | 0.47 | 6.57 | 8.51 | 0 | 6.77 | 0.33 | 118 | PASS |
| stress1000_compact_concentrated | 1000 | COMPACT | disabled | 173718 | 0.34 | 0.33 | 2.96 | 31.45 | 1 | 3.20 | 0.16 | 113 | PASS |
| stress2000_compact_concentrated | 2000 | COMPACT | disabled | 140532 | 0.43 | 0.39 | 5.28 | 6.75 | 0 | 5.38 | 0.24 | 113 | PASS |
| stress1000_compact_bottleneck | 1000 | COMPACT | disabled | 163130 | 0.37 | 0.34 | 3.86 | 5.65 | 0 | 4.12 | 0.18 | 113 | PASS |
| vsync_normal50_compact_spread | 50 | COMPACT | enabled | 4941 | 9.56 | 6.76 | 6.90 | 1002.20 | 20 | 1.11 | 0.16 | 113 | PASS |
| vsync_stress2000_enlarged_spread | 2000 | ENLARGED | enabled | 5400 | 5.55 | 12.40 | 12.74 | 14.63 | 0 | 6.93 | 0.57 | 118 | PASS |
| firstuse_normal50_compact | 50 | COMPACT | disabled | 16935 | 0.29 | 0.34 | 0.67 | 1.77 | 0 | 0.94 | 0.11 | 113 | PASS |
| firstuse_stress2000_enlarged | 2000 | ENLARGED | disabled | 9416 | 0.53 | 0.43 | 7.34 | 8.24 | 0 | 7.24 | 0.28 | 118 | PASS |
| soak_stress1000_headless_10min | 1000 | COMPACT | enabled | 36001 | 3.53 | 4.09 | 4.39 | 6.71 | 0 | 3.92 | 0.00 | 0 | PASS |
| vsync_normal50_compact_spread_rerun | 50 | COMPACT | enabled | 5401 | 5.56 | 6.72 | 6.86 | 8.09 | 0 | 1.10 | 0.16 | 113 | PASS |
`soak_stress1000_headless_10min` is a headless simulation soak (no rendering); its frame times
are simulation-only. `vsync_normal50_compact_spread_rerun` repeats the VSync-on check (see below).
### Summary
* **Normal demo (25 / 50 birds): pass.** p95 0.36 / 0.35 ms, p99 ≤ 0.73 ms, worst frame 3.4 ms
uncapped; with VSync on, 5,401 frames in 30 s (180 Hz), p95 6.7 ms, 0 frames over 16.67 ms.
* **Largest tested passing population: 2,000 birds**, on both the enlarged layout (spread,
concentrated, bottleneck) and the compact congestion layout: p95 ≤ 0.47 ms, p99 ≤ 6.7 ms,
worst frame ≤ 8.5 ms, 0 frames over 16.67 ms. With VSync on at 2,000 birds: 5,400 frames in
30 s (180 Hz), p95 12.4 ms, max 14.6 ms. Nothing above 2,000 was tested, so no higher limit is
claimed.
* **The bottleneck is the GDScript simulation, not rendering.** GPU time stays ≤ 0.6 ms (p95) and
draw calls ~113–118 at every size (one MultiMesh batch for birds, one for bullets). Uncapped
frames are bimodal: frames without a physics tick cost ~0.3 ms; frames containing one cost
about one simulation tick, which is why p95 is tiny while p99 tracks `sim p95`.
* Simulation tick cost scales about linearly, ~3.2 µs per bird: 0.96 ms (50) → 3.8 ms (1,000)
→ 6.7 ms (2,000) p95. Profile at 2,000 birds: steering (separation, one third of birds per
tick) 3.7 ms, motion + collision 1.8 ms, flow-field slice 0.3 ms mean / ≤ 1.1 ms max, grid
0.3 ms, render upload 0.2 ms.
* Pools: 0 skipped bird spawns and 0 exhausted bullets in every run; bullets peaked at 8 of 64.
### Spikes and caveats
* **First shot / first hit:** measured separately with the first shot delayed to 3 s. Worst
frame in the 0.5 s after the first shot vs. the 0.5 s before it: 1.50 vs 1.38 ms (50 birds),
7.50 vs 7.34 ms (2,000 birds); after the first hit 1.50 / 7.53 ms. No first-use stutter beyond
normal frame variation. (In the main matrix the first shot happens 0.14 s into the round, so
its "first-shot" numbers mix in start-up frames; use the `firstuse_*` runs.)
* **Start-up hitches:** the first second after the round starts contains single frames of
10–36 ms (`firstuse_*`: 10.0 ms at 50 birds, 35.8 ms at 2,000), and the matrix's first-second
windows saw ~750 ms frames in two compact runs. These happen right after loading and the
fullscreen switch; their cause was not isolated (not profiled further).
* `stress1000_compact_concentrated`: one 31.5 ms frame in 173,718; the longest simulation tick
in that run was 3.9 ms, so the stall came from outside the game loop (OS, compositor, or
driver). It did not recur in the other runs.
* The first `vsync_normal50_compact_spread` run had 20 stalls of ~1 s (its longest simulation
tick was 1.4 ms). The repeat run had none. This matches the compositor's throttling of
windows it considers not visible; the cause was not confirmed.
* Memory: flat during every capture (e.g. 89.83 MB start and end for the normal demo); the
10-minute 1,000-bird recycle soak went 73.70 → 73.75 MB (the report's own timeline) with
1,956 → 1,957 objects, 196 nodes throughout, and flat tick time (~3.35 ms) after 3,389
recycled birds. During that soak a short profiling run was briefly executed concurrently.
* **Not a release build**: an exported release template would likely run the GDScript
simulation somewhat faster; that was not measured.
* One machine only; a much weaker CPU will reach the 16.67 ms budget at far fewer birds, since
the simulation cost is single-threaded GDScript.