[PR #5715] [MERGED] Entity tracking: static attribute ids, movement speed looked up once per mob #6458

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

📋 Pull Request Information

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

Base: main ← Head: perf/lan-attribute-ids


📝 Commits (2)

  • 75a9116 Attributes: static registry ids, not format! per mob and tick
  • bc1d4d1 Entity tracking: a mob's movement speed looked up once per tick

📊 Changes

2 files changed (+32 additions, -22 deletions)

View changed files

📝 crates/horizon-client/src/game/lan_attributes.rs (+16 -18)
📝 crates/horizon-client/src/mobs/finalize.rs (+16 -4)

📄 Description

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

The server rebuilds each tracked mob's state every tick (lan_entities → mob_attributes). For nearly every mob, that path did the following:

  • Repeated movement-speed lookups: it asked the attribute catalog for minecraft:movement_speed by name up to three times, for the instance, the baby modifier and the sprinting modifier. It also recomputed the speed's base value each time.
  • format! per attribute: it built every attribute's registry id with format!("minecraft:{}", …). It did this in mob_attributes for the bases and modifiers set by /attribute and finalizeSpawn, and in finalize::default_value, which mob AI also calls.

Changes:

  1. Attr::id() returns the static registry id. This takes the commit of server-perf-1's branch perf/attr-ids (sp1 dropped it then because it measured at 60 bots on MSPT alone, where the gain is within noise).
  2. Movement speed is looked up once per mob and tick. The instance and both modifiers share that lookup.

The values sent are the same: same attribute ids, same bases, same modifiers, in the same order. Only the lookups changed.

Measurement

playhorizon (EPYC, CPUs 0-3, exclusive), server_bench.py horizon, 20 mixed bots, 3 alternated rounds. Both binaries are main b6ac0602d plus bench-only sub-spans of tick_lan (bench/sp2-lanb, not for merge). The test binary adds this PR (bench/sp2-lant).

ms/tick round 1 round 2 round 3 median
lan_entities, main 1.10 1.14 1.13 1.13
lan_entities, this PR 0.88 0.93 0.92 0.92 (−19 %)
tick_lan, main 4.49 4.56 4.52 4.52
tick_lan, this PR 4.16 4.29 4.27 4.27
MSPT, main 26.97 26.90 27.45 26.97
MSPT, this PR 26.12 26.82 26.58 26.58

Checks

  • pr_ready --quick: pass. Results: fmt, clippy -D warnings, 1635 horizon-client tests, 511 Python tests.
  • attribute_updates harness: PASS locally.
  • The other 59 affected harnesses run in CI (run-parity), lan_e2e included.

🤖 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/5715 **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/lan-attribute-ids` --- ### 📝 Commits (2) - [`75a9116`](https://github.com/horizon-rust/horizon/commit/75a9116efba2ae3098d195509a0b0ead9ccb4b4f) Attributes: static registry ids, not format! per mob and tick - [`bc1d4d1`](https://github.com/horizon-rust/horizon/commit/bc1d4d15163fb00fb652424a6a276c39d4d5e6df) Entity tracking: a mob's movement speed looked up once per tick ### 📊 Changes **2 files changed** (+32 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/lan_attributes.rs` (+16 -18) 📝 `crates/horizon-client/src/mobs/finalize.rs` (+16 -4) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. The server rebuilds each tracked mob's state every tick (`lan_entities` → `mob_attributes`). For nearly every mob, that path did the following: - **Repeated movement-speed lookups:** it asked the attribute catalog for `minecraft:movement_speed` by name up to three times, for the instance, the baby modifier and the sprinting modifier. It also recomputed the speed's base value each time. - **`format!` per attribute:** it built every attribute's registry id with `format!("minecraft:{}", …)`. It did this in `mob_attributes` for the bases and modifiers set by `/attribute` and `finalizeSpawn`, and in `finalize::default_value`, which mob AI also calls. Changes: 1. `Attr::id()` returns the static registry id. This takes the commit of server-perf-1's branch `perf/attr-ids` (sp1 dropped it then because it measured at 60 bots on MSPT alone, where the gain is within noise). 2. Movement speed is looked up once per mob and tick. The instance and both modifiers share that lookup. The values sent are the same: same attribute ids, same bases, same modifiers, in the same order. Only the lookups changed. ### Measurement playhorizon (EPYC, CPUs 0-3, exclusive), `server_bench.py` horizon, 20 mixed bots, 3 alternated rounds. Both binaries are main b6ac0602d plus bench-only sub-spans of `tick_lan` (`bench/sp2-lanb`, not for merge). The test binary adds this PR (`bench/sp2-lant`). | ms/tick | round 1 | round 2 | round 3 | median | |---|---|---|---|---| | `lan_entities`, main | 1.10 | 1.14 | 1.13 | 1.13 | | `lan_entities`, this PR | 0.88 | 0.93 | 0.92 | **0.92 (−19 %)** | | `tick_lan`, main | 4.49 | 4.56 | 4.52 | 4.52 | | `tick_lan`, this PR | 4.16 | 4.29 | 4.27 | **4.27** | | MSPT, main | 26.97 | 26.90 | 27.45 | 26.97 | | MSPT, this PR | 26.12 | 26.82 | 26.58 | 26.58 | ### Checks - `pr_ready --quick`: pass. Results: fmt, clippy -D warnings, 1635 horizon-client tests, 511 Python tests. - `attribute_updates` harness: PASS locally. - The other 59 affected harnesses run in CI (run-parity), `lan_e2e` included. 🤖 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:21:00 +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#6458
No description provided.