[PR #6808] [MERGED] perf_bench: many-entity stress scenes, per-scene client tick and memory #7109

Closed
opened 2026-11-03 06:33:59 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6808
Author: @ludovic111
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: perf/entities-stress


📝 Commits (3)

  • 7a52fde perf_bench: many-entity stress scenes, per-scene client tick and memory
  • f4ee603 Merge remote-tracking branch 'origin/main' into perf/entities-stress
  • 76aa871 Merge remote-tracking branch 'origin/main' into perf/entities-stress

📊 Changes

8 files changed (+443 additions, -14 deletions)

View changed files

📝 docs/benchmark-report.md (+3 -0)
📝 docs/benchmark.md (+12 -0)
📝 mods/horizon/src/bench/java/dev/horizonlab/bench/VanillaBench.java (+37 -5)
➕ mods/horizon/src/bench/java/dev/horizonlab/bench/mixin/TickHookMixin.java (+23 -0)
📝 mods/horizon/src/bench/resources/horizon_bench.mixins.json (+2 -1)
📝 tests/test_perf_bench.py (+63 -0)
📝 tools/perf_bench.py (+95 -8)
➕ tools/stress_scenes.py (+208 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

What

tools/perf_bench.py --scenes stress measures the client with many entities at once, the same way in Horizon and in vanilla (and vanilla-mods).

tools/stress_scenes.py builds nine scenes with vanilla commands, on a platform above the spawn at (-520, 289, 40). Each scene is removed (kill + fill air in slabs) before the next one, so no terrain is generated between scenes. The scenes:

  • empty (the baseline);
  • 1000 mobs of 8 kinds, frozen with NoAI;
  • 2000 dropped items that never despawn;
  • 512 item frames with items;
  • 500 armor stands;
  • 800 chests, ender chests and shulker boxes;
  • 687 signs with text;
  • 300 banners;
  • steady particles from redstone-powered repeating command blocks.

The same command lines run in Horizon (through horizon-ctl command) and in vanilla. On the vanilla side, the bench mod gains per-scene setup and cleanup in VanillaBench, and TickHookMixin times Minecraft.tick.

Each scene is held still and reports these metrics, next to the existing fps ones:

  • cpu.<scene>.p50_ms: frame CPU time;
  • tick.<scene>.client_ms: client tick time;
  • memory.<scene>.rss_mb: resident memory.

tests/test_perf_bench.py covers the scene script:

  • each scene has its entity counts;
  • every entity is close enough to be drawn at RD 16;
  • commands are single lines inside the world;
  • the cleanup covers every block a scene places;
  • --scenes stress selects them all. docs/benchmark.md documents it.

First numbers: Horizon (main) vs vanilla 26.3

Setup:

  • Machine: Mac mini M4 Pro, 64 GB, RD 16, 1280×720 offscreen, 10 s per scene.
  • Horizon: main's mob path (HORIZON_NO_ENTITY_SKIN=1 on a build at 0454e97e32, i.e. without #6757's GPU posing), mean of 2 runs.
  • Vanilla: 3 runs.
  • Load: the machine was shared with other agents' work, so whole numbers move by ±20%. The ratios are steady.
Scene Horizon avg fps Vanilla avg fps Horizon 1% low Vanilla 1% low Horizon frame CPU p50 Horizon client tick Vanilla client tick Horizon RSS Vanilla RSS
empty 1679 437 (×3.8) 416 114 0.36 ms 0.33 ms 0.52 ms 1327 MB 1903 MB
mobs 201 83 (×2.4) 151 39 4.57 ms 0.60 ms 1.44 ms 1499 MB 1992 MB
items 159 47 (×3.4) 124 20 5.90 ms 0.82 ms 8.26 ms 1510 MB 2041 MB
frames 379 119 (×3.2) 265 33 2.33 ms 0.26 ms 0.61 ms 1535 MB 2027 MB
armor_stands 114 51 (×2.2) 96 10 8.36 ms 0.44 ms 2.75 ms 1625 MB 2054 MB
chests 822 195 (×4.2) 370 52 0.89 ms 0.49 ms 0.67 ms 1642 MB 2026 MB
signs 1027 95 (×10.8) 370 17 0.54 ms 0.43 ms 0.80 ms 1648 MB 2028 MB
banners 883 175 (×5.0) 330 59 0.80 ms 0.43 ms 0.46 ms 1652 MB 2028 MB
particles 510 141 (×3.6) 122 26 1.43 ms 5.62 ms 8.96 ms 1660 MB 2035 MB

GPU posing (#6757, merged) raises mobs from about 201 to 277–307 fps (frame CPU time 4.5 → 3.2 ms).

The weakest ratios are the next targets:

  • armor stands: 8.4 ms of frame CPU time, still posed on the CPU;
  • mobs;
  • dropped items: 5.9 ms;
  • particles: 5.6 ms of client tick.

Not measured yet:

  • vanilla-mods (Sodium, Lithium, FerriteCore, ImmediatelyFast) on these scenes. The GPU bench lock and the Mac's disk (under 25 GB) stopped the run; --game vanilla-mods --scenes stress runs it.
  • The server-thread side of the same scenes.

Checks

head 76aa871c1e (main merged: the --server / --server-bots scenes and the stress scenes run together)
python3 -m unittest discover -s tests                        607 ok, 1 skipped
build_bench_mod (javac --release 25 against the 26.3 client) ok
python3 tools/perf_bench.py --game vanilla --scenes stress   3 full runs (the table)
python3 tools/perf_bench.py --game horizon --scenes stress   2 full runs (the table)

No Rust changes.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/6808 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/entities-stress` --- ### 📝 Commits (3) - [`7a52fde`](https://github.com/horizon-rust/horizon/commit/7a52fde28f426e9e55c2c27056f1b6fab3b2494c) perf_bench: many-entity stress scenes, per-scene client tick and memory - [`f4ee603`](https://github.com/horizon-rust/horizon/commit/f4ee603baf6941c084203dee49c1666f65e3c082) Merge remote-tracking branch 'origin/main' into perf/entities-stress - [`76aa871`](https://github.com/horizon-rust/horizon/commit/76aa871c1e775aec4089a49d5341a8dc52e52cdb) Merge remote-tracking branch 'origin/main' into perf/entities-stress ### 📊 Changes **8 files changed** (+443 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `docs/benchmark-report.md` (+3 -0) 📝 `docs/benchmark.md` (+12 -0) 📝 `mods/horizon/src/bench/java/dev/horizonlab/bench/VanillaBench.java` (+37 -5) ➕ `mods/horizon/src/bench/java/dev/horizonlab/bench/mixin/TickHookMixin.java` (+23 -0) 📝 `mods/horizon/src/bench/resources/horizon_bench.mixins.json` (+2 -1) 📝 `tests/test_perf_bench.py` (+63 -0) 📝 `tools/perf_bench.py` (+95 -8) ➕ `tools/stress_scenes.py` (+208 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What `tools/perf_bench.py --scenes stress` measures the client with many entities at once, the same way in Horizon and in vanilla (and vanilla-mods). `tools/stress_scenes.py` builds nine scenes with vanilla commands, on a platform above the spawn at (-520, 289, 40). Each scene is removed (kill + fill air in slabs) before the next one, so no terrain is generated between scenes. The scenes: - empty (the baseline); - 1000 mobs of 8 kinds, frozen with `NoAI`; - 2000 dropped items that never despawn; - 512 item frames with items; - 500 armor stands; - 800 chests, ender chests and shulker boxes; - 687 signs with text; - 300 banners; - steady particles from redstone-powered repeating command blocks. The same command lines run in Horizon (through `horizon-ctl command`) and in vanilla. On the vanilla side, the bench mod gains per-scene setup and cleanup in `VanillaBench`, and `TickHookMixin` times `Minecraft.tick`. Each scene is held still and reports these metrics, next to the existing fps ones: - `cpu.<scene>.p50_ms`: frame CPU time; - `tick.<scene>.client_ms`: client tick time; - `memory.<scene>.rss_mb`: resident memory. `tests/test_perf_bench.py` covers the scene script: - each scene has its entity counts; - every entity is close enough to be drawn at RD 16; - commands are single lines inside the world; - the cleanup covers every block a scene places; - `--scenes stress` selects them all. `docs/benchmark.md` documents it. ## First numbers: Horizon (main) vs vanilla 26.3 Setup: - **Machine:** Mac mini M4 Pro, 64 GB, RD 16, 1280×720 offscreen, 10 s per scene. - **Horizon:** main's mob path (`HORIZON_NO_ENTITY_SKIN=1` on a build at 0454e97e32, i.e. without #6757's GPU posing), mean of 2 runs. - **Vanilla:** 3 runs. - **Load:** the machine was shared with other agents' work, so whole numbers move by ±20%. The ratios are steady. | Scene | Horizon avg fps | Vanilla avg fps | Horizon 1% low | Vanilla 1% low | Horizon frame CPU p50 | Horizon client tick | Vanilla client tick | Horizon RSS | Vanilla RSS | |---|---|---|---|---|---|---|---|---|---| | empty | 1679 | 437 (×3.8) | 416 | 114 | 0.36 ms | 0.33 ms | 0.52 ms | 1327 MB | 1903 MB | | mobs | 201 | 83 (×2.4) | 151 | 39 | 4.57 ms | 0.60 ms | 1.44 ms | 1499 MB | 1992 MB | | items | 159 | 47 (×3.4) | 124 | 20 | 5.90 ms | 0.82 ms | 8.26 ms | 1510 MB | 2041 MB | | frames | 379 | 119 (×3.2) | 265 | 33 | 2.33 ms | 0.26 ms | 0.61 ms | 1535 MB | 2027 MB | | armor_stands | 114 | 51 (×2.2) | 96 | 10 | 8.36 ms | 0.44 ms | 2.75 ms | 1625 MB | 2054 MB | | chests | 822 | 195 (×4.2) | 370 | 52 | 0.89 ms | 0.49 ms | 0.67 ms | 1642 MB | 2026 MB | | signs | 1027 | 95 (×10.8) | 370 | 17 | 0.54 ms | 0.43 ms | 0.80 ms | 1648 MB | 2028 MB | | banners | 883 | 175 (×5.0) | 330 | 59 | 0.80 ms | 0.43 ms | 0.46 ms | 1652 MB | 2028 MB | | particles | 510 | 141 (×3.6) | 122 | 26 | 1.43 ms | 5.62 ms | 8.96 ms | 1660 MB | 2035 MB | GPU posing (#6757, merged) raises mobs from about 201 to 277–307 fps (frame CPU time 4.5 → 3.2 ms). The weakest ratios are the next targets: - armor stands: 8.4 ms of frame CPU time, still posed on the CPU; - mobs; - dropped items: 5.9 ms; - particles: 5.6 ms of client tick. Not measured yet: - **vanilla-mods** (Sodium, Lithium, FerriteCore, ImmediatelyFast) on these scenes. The GPU bench lock and the Mac's disk (under 25 GB) stopped the run; `--game vanilla-mods --scenes stress` runs it. - **The server-thread side** of the same scenes. ## Checks ``` head 76aa871c1e (main merged: the --server / --server-bots scenes and the stress scenes run together) python3 -m unittest discover -s tests 607 ok, 1 skipped build_bench_mod (javac --release 25 against the 26.3 client) ok python3 tools/perf_bench.py --game vanilla --scenes stress 3 full runs (the table) python3 tools/perf_bench.py --game horizon --scenes stress 2 full runs (the table) ``` No Rust changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:33:59 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#7109
No description provided.