[PR #6268] [MERGED] Dedicated server: item renderer without client item definitions (−2.1 MB idle) #6756

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

📋 Pull Request Information

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

Base: main ← Head: perf/server-item-renderer


📝 Commits (1)

  • 842be48 Dedicated server: item renderer without the client item definitions

📊 Changes

2 files changed (+65 additions, -9 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+6 -4)
📝 crates/horizon-client/src/item_render.rs (+59 -5)

📄 Description

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

What

A dedicated server's ItemRenderer loaded what only drawing reads: the ~1,500 client item definitions (assets/*/items/**/*.json), the special renderers' entity model parts and the grass colormap. ItemRenderer::load_for_server (used by load_core when headless, i.e. --dedicated) keeps the prototypes (the stacks' default components, which gameplay reads: attack range, break sound, consumables…) and the item ids. Clients are unchanged.

  • Heap (Mac counting-allocator probe): ItemRenderer 7.26 MB = prototypes 5.88 + definitions 0.94 + parts/grass/ids 0.44; the server saves the last two (~1.4 MB) and ~1,500 file reads on a load worker.
  • Test a_server_keeps_prototypes_without_definitions.

A/B

Bench: playhorizon (CPUs 0-3, remote.sh --exclusive), fast profile, dedicated server, new world (seed 12345), MIMALLOC_ALLOW_THP=0, anonymous memory (smaps_rollup) 32 s after Done, 5 rounds alternated base → lan → cmd → items. Base = main c86e861455.

round base anon (MB) this PR (MB) direction
1 172.1 171.8 −0.3
2 172.0 169.3 −2.7
3 171.6 169.7 −1.9
4 172.8 171.4 −1.4
5 172.5 170.0 −2.5
median 172.1 170.0 −2.1 MB, 5/5

Startup: round 1 (quiet host) Done 1.965 s → 1.946 s; rounds 2-5 unusable (CI load on the host, 6-15 s for every binary). MSPT: not measured; nothing on the tick path.

🤖 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/6268 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/server-item-renderer` --- ### 📝 Commits (1) - [`842be48`](https://github.com/horizon-rust/horizon/commit/842be48d6e765f2ad9af2f934ab8b2fd41469fef) Dedicated server: item renderer without the client item definitions ### 📊 Changes **2 files changed** (+65 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+6 -4) 📝 `crates/horizon-client/src/item_render.rs` (+59 -5) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What A dedicated server's `ItemRenderer` loaded what only drawing reads: the ~1,500 client item definitions (`assets/*/items/**/*.json`), the special renderers' entity model parts and the grass colormap. `ItemRenderer::load_for_server` (used by `load_core` when headless, i.e. `--dedicated`) keeps the prototypes (the stacks' default components, which gameplay reads: attack range, break sound, consumables…) and the item ids. Clients are unchanged. - Heap (Mac counting-allocator probe): ItemRenderer 7.26 MB = prototypes 5.88 + definitions 0.94 + parts/grass/ids 0.44; the server saves the last two (~1.4 MB) and ~1,500 file reads on a load worker. - Test `a_server_keeps_prototypes_without_definitions`. ## A/B Bench: playhorizon (CPUs 0-3, `remote.sh --exclusive`), `fast` profile, dedicated server, new world (seed 12345), `MIMALLOC_ALLOW_THP=0`, anonymous memory (`smaps_rollup`) 32 s after `Done`, 5 rounds alternated base → lan → cmd → items. Base = main c86e861455. | round | base anon (MB) | this PR (MB) | direction | |---|---|---|---| | 1 | 172.1 | 171.8 | −0.3 | | 2 | 172.0 | 169.3 | −2.7 | | 3 | 171.6 | 169.7 | −1.9 | | 4 | 172.8 | 171.4 | −1.4 | | 5 | 172.5 | 170.0 | −2.5 | | **median** | **172.1** | **170.0** | **−2.1 MB, 5/5** | Startup: round 1 (quiet host) Done 1.965 s → 1.946 s; rounds 2-5 unusable (CI load on the host, 6-15 s for every binary). MSPT: not measured; nothing on the tick path. 🤖 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:26:09 +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#6756
No description provided.