[PR #6825] [MERGED] horizon-ctl memory: the game's memory by category #7118

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

📋 Pull Request Information

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

Base: main ← Head: perf/memory-census


📝 Commits (2)

  • 7861eb2 horizon-ctl memory: the game's memory by category
  • 99f043f horizon-ctl commands reference: the memory command

📊 Changes

12 files changed (+282 additions, -0 deletions)

View changed files

📝 crates/horizon-client-render/src/chunk.rs (+68 -0)
📝 crates/horizon-client-render/src/gfx.rs (+47 -0)
📝 crates/horizon-client-render/src/gfx/resident.rs (+16 -0)
📝 crates/horizon-client/Cargo.toml (+3 -0)
📝 crates/horizon-client/src/bin/horizon-ctl/commands.rs (+2 -0)
📝 crates/horizon-client/src/game.rs (+1 -0)
📝 crates/horizon-client/src/game/control.rs (+1 -0)
📝 crates/horizon-client/src/game/levels.rs (+5 -0)
➕ crates/horizon-client/src/game/memory.rs (+107 -0)
📝 crates/horizon-client/src/main.rs (+1 -0)
📝 crates/horizon-threads/src/lib.rs (+30 -0)
📝 docs/horizon-ctl-commands.md (+1 -0)

📄 Description

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

What

horizon-ctl memory (and the MCP tool memory) reports what holds the game's memory, by category. Memory work can then be ranked, and every memory PR can show an A/B per category.

  • process: the resident set, and mimalloc's committed bytes now and at peak.
  • client_columns / server_columns: the window's columns and, in single player, the server thread's own levels (every dimension, through Integrated::call). Each is broken down into blocks, biomes, light, heightmaps, and section and column records. A section shared by several columns counts once.
  • renderer:
    • section arenas and vertices;
    • its per-section bookkeeping (resident sections, far tiles, block entities, light sources);
    • the GPU allocator's memory by resource label (Vulkan and DirectX 12).
  • Cargo feature horizon-client/system-allocator: Rust's allocations go to malloc instead of mimalloc, so heaptrack or massif can see them. For profiling only.
  • docs/horizon-ctl-commands.md gets the command's row.

No change for players (skip-release). Followed by #6826 and #6827, which use it for their A/B.

What it shows

playhorizon (Linux, 8 vCPU shared with other jobs, load 14-29), headless single player on the server thread, seed 1234, creative. Three rounds, each running the variants side by side; medians, and the direction of each round's pair. At RD 32 the window settled at 3,725 columns and the server at 4,761.

title RD 16 RD 32
RSS 362 MB 702 MB 1,078 MB
allocator committed 857 MB 1,192 MB
window's columns 44.6 MB (light 21.5) 150.9 MB (blocks 70, light 72.8)
server thread's columns 58.0 MB (light 27.9) 191.2 MB (light 91.6)
  • Light was about half of the column bytes, which led to #6826.
  • The window and the server held the same sections twice, which led to #6827.
  • What isn't columns at RD 32, about 740 MB, is resources, world generation and caches: the next thing to measure.
  • With a renderer (llvmpipe), the title screen holds 131 MB of GPU memory: "Shared atlas" 80 MB (4096x5120 RGBA8) and "Block sprites" 28 MB.

Checks

pr_ready --quick on playhorizon, run on the top of the stack (#6827, which contains this branch). clippy was installed on that host's toolchain for it.

Check Result
Scope ⚠️ 21 files, +632 −132; 763 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅ (1 s)
Python tests ❌ 598 run, FAILED (failures=2, skipped=1) (2 min 54 s)
rustfmt ✅ (1 min 15 s)
clippy ✅ (9 min 19 s)
tests: horizon-client, horizon-client-lib, horizon-client-render, horizon-core, horizon-threads ✅ 3054 passed (45 min 27 s)
doc tests ✅ 0 passed (7 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 146 affected, to run in CI (--quick): ambient_sound, armor_stand_frost, arrow, arrow_wind_charge, audio_attributes, auto_jump, blending, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal and 134 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)
  • Python tests: test_lab.GameEnvScreenTests fails twice because the host's runner environment sets VSCREEN. This stack touches no Python.
  • Parity: left to CI's parity job.

The pr_ready block above ran on adaeb5141e, before the stack was rebased onto main. On the rebased head, cargo check of the client and client lib (bins and tests) passes; see #6826 for the mesher change the rebase needed.

🤖 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/6825 **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/memory-census` --- ### 📝 Commits (2) - [`7861eb2`](https://github.com/horizon-rust/horizon/commit/7861eb20b2c52956c2d4427facb8e99e9086575e) horizon-ctl memory: the game's memory by category - [`99f043f`](https://github.com/horizon-rust/horizon/commit/99f043fd64fb01ecec9054c9a6a0db78c467e254) horizon-ctl commands reference: the memory command ### 📊 Changes **12 files changed** (+282 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/chunk.rs` (+68 -0) 📝 `crates/horizon-client-render/src/gfx.rs` (+47 -0) 📝 `crates/horizon-client-render/src/gfx/resident.rs` (+16 -0) 📝 `crates/horizon-client/Cargo.toml` (+3 -0) 📝 `crates/horizon-client/src/bin/horizon-ctl/commands.rs` (+2 -0) 📝 `crates/horizon-client/src/game.rs` (+1 -0) 📝 `crates/horizon-client/src/game/control.rs` (+1 -0) 📝 `crates/horizon-client/src/game/levels.rs` (+5 -0) ➕ `crates/horizon-client/src/game/memory.rs` (+107 -0) 📝 `crates/horizon-client/src/main.rs` (+1 -0) 📝 `crates/horizon-threads/src/lib.rs` (+30 -0) 📝 `docs/horizon-ctl-commands.md` (+1 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What `horizon-ctl memory` (and the MCP tool `memory`) reports what holds the game's memory, by category. Memory work can then be ranked, and every memory PR can show an A/B per category. - `process`: the resident set, and mimalloc's committed bytes now and at peak. - `client_columns` / `server_columns`: the window's columns and, in single player, the server thread's own levels (every dimension, through `Integrated::call`). Each is broken down into blocks, biomes, light, heightmaps, and section and column records. A section shared by several columns counts once. - `renderer`: - section arenas and vertices; - its per-section bookkeeping (resident sections, far tiles, block entities, light sources); - the GPU allocator's memory **by resource label** (Vulkan and DirectX 12). - Cargo feature `horizon-client/system-allocator`: Rust's allocations go to malloc instead of mimalloc, so heaptrack or massif can see them. For profiling only. - docs/horizon-ctl-commands.md gets the command's row. No change for players (`skip-release`). Followed by #6826 and #6827, which use it for their A/B. ## What it shows playhorizon (Linux, 8 vCPU shared with other jobs, load 14-29), headless single player on the server thread, seed 1234, creative. Three rounds, each running the variants side by side; medians, and the direction of each round's pair. At RD 32 the window settled at 3,725 columns and the server at 4,761. | | title | RD 16 | RD 32 | |---|---|---|---| | RSS | 362 MB | 702 MB | 1,078 MB | | allocator committed | | 857 MB | 1,192 MB | | window's columns | | 44.6 MB (light 21.5) | 150.9 MB (blocks 70, light 72.8) | | server thread's columns | | 58.0 MB (light 27.9) | 191.2 MB (light 91.6) | - Light was about half of the column bytes, which led to #6826. - The window and the server held the same sections twice, which led to #6827. - What isn't columns at RD 32, about 740 MB, is resources, world generation and caches: the next thing to measure. - With a renderer (llvmpipe), the title screen holds 131 MB of GPU memory: "Shared atlas" 80 MB (4096x5120 RGBA8) and "Block sprites" 28 MB. ## Checks `pr_ready --quick` on playhorizon, run on the top of the stack (#6827, which contains this branch). clippy was installed on that host's toolchain for it. | Check | Result | | --- | --- | | Scope | ⚠️ 21 files, +632 −132; 763 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (1 s) | | Python tests | ❌ 598 run, FAILED (failures=2, skipped=1) (2 min 54 s) | | rustfmt | ✅ (1 min 15 s) | | clippy | ✅ (9 min 19 s) | | tests: horizon-client, horizon-client-lib, horizon-client-render, horizon-core, horizon-threads | ✅ 3054 passed (45 min 27 s) | | doc tests | ✅ 0 passed (7 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 146 affected, to run in CI (--quick): ambient_sound, armor_stand_frost, arrow, arrow_wind_charge, audio_attributes, auto_jump, blending, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal and 134 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | - **Python tests**: `test_lab.GameEnvScreenTests` fails twice because the host's runner environment sets `VSCREEN`. This stack touches no Python. - **Parity**: left to CI's parity job. The pr_ready block above ran on adaeb5141e, before the stack was rebased onto main. On the rebased head, `cargo check` of the client and client lib (bins and tests) passes; see #6826 for the mesher change the rebase needed. 🤖 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:34:13 +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#7118
No description provided.