[PR #842] [MERGED] Locator bar: update each connection in place, without clones #2851

Closed
opened 2026-11-02 15:59:35 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/842
Author: @ludovic111
Created: 10/18/2026
Status: ✅ Merged
Merged: 10/18/2026
Merged by: @ludovic111

Base: main ← Head: perf/waypoint-lookups


📝 Commits (1)

  • 4db5110 Locator bar: update each connection in place, without clones

📊 Changes

1 file changed (+33 additions, -23 deletions)

View changed files

📝 crates/horizon-client/src/lan/waypoints.rs (+33 -23)

📄 Description

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

What

The server's locator bar (lan::waypoints, vanilla's ServerWaypointManager) does the same work with less overhead:

  • updateConnection changes the connection where it is in the receiver's row: one scan instead of copying it out (with its icon's style string) and scanning again to put it back.
  • updatePlayer and updateWaypoint walk the waypoints and players by index instead of copying the lists for every moving player.
  • Connection.update sends the icon by reference instead of cloning it first.
  • The maps keyed by player UUID use FxHash instead of SipHash. None of them is iterated where the order reaches a packet.

The rows keep their order, so the packets and their order are unchanged.

Why

Task 2 of perf-server-8: with the entity tracking change (PR #841) in, the locator bar was the largest remaining part of tick_lan under the 40-player load: 494–882 sample samples out of 2072–2663, about a quarter to a third. Every moving player updates its connection to every other player (P² a tick), and each update cost two linear scans, a string clone and several SipHash lookups.

Measured

Mac mini M4 Pro, busy and shared (another harness run going), alternating runs. Flat world, 40 walking horizon-bots, about 600 entities around spawn, /tick query every 5 s for 60 s after a 20 s warm-up, sample of the engine for 20 s. Both sides are without the entity tracking change.

run MSPT avg P50 P95 world tick samples tick_lan Waypoints::tick
main #1 42.9 35.9 110.9 6278 2756 389
this #1 31.0 22.9 87.9 6773 3069 108
main #2 44.7 32.3 127.1 7366 3652 568
this #2 39.4 30.8 111.1 7217 3473 168

Waypoints::tick is 3.5 times cheaper. The MSPT differences are within this machine's noise: the locator bar was 6–8 % of the tick.

How tested

Run on the Mac mini, on an integration commit of this PR and the entity tracking one (#841), rebased on main:

cargo fmt --all --check                                          ok
cargo clippy --workspace --all-targets -- -D warnings            ok
cargo test -p horizon-client --lib                               864 passed, 0 failed
PARITY_LOCAL_JOBS=4 python3 tools/parity.py --changed origin/main
  before the last rebase: 93 passed, 1 failed (tooltip_display: its harness wrote Python's
  `False`; fixed on main by #837, and it passes on main and here since)
  on the rebased commit:  95 passed, 0 failed (32 min)

locator_bar (the waypoint packets two vanilla clients receive from Horizon's server against vanilla's, exactly) passes, as do lan, dedicated_server and server_dimension_players, and the lan::waypoints unit tests.

Needs Ludovic

Nothing.

🤖 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/842 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/18/2026 **Status:** ✅ Merged **Merged:** 10/18/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/waypoint-lookups` --- ### 📝 Commits (1) - [`4db5110`](https://github.com/horizon-rust/horizon/commit/4db511079d3bf4314d3338832f5f5f57e2efc467) Locator bar: update each connection in place, without clones ### 📊 Changes **1 file changed** (+33 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/lan/waypoints.rs` (+33 -23) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What The server's locator bar (`lan::waypoints`, vanilla's `ServerWaypointManager`) does the same work with less overhead: - `updateConnection` changes the connection where it is in the receiver's row: one scan instead of copying it out (with its icon's style string) and scanning again to put it back. - `updatePlayer` and `updateWaypoint` walk the waypoints and players by index instead of copying the lists for every moving player. - `Connection.update` sends the icon by reference instead of cloning it first. - The maps keyed by player UUID use FxHash instead of SipHash. None of them is iterated where the order reaches a packet. The rows keep their order, so the packets and their order are unchanged. ## Why Task 2 of perf-server-8: with the entity tracking change (PR #841) in, the locator bar was the largest remaining part of `tick_lan` under the 40-player load: 494–882 `sample` samples out of 2072–2663, about a quarter to a third. Every moving player updates its connection to every other player (P² a tick), and each update cost two linear scans, a string clone and several SipHash lookups. ## Measured Mac mini M4 Pro, busy and shared (another harness run going), alternating runs. Flat world, 40 walking `horizon-bots`, about 600 entities around spawn, `/tick query` every 5 s for 60 s after a 20 s warm-up, `sample` of the engine for 20 s. Both sides are without the entity tracking change. | run | MSPT avg | P50 | P95 | world tick samples | `tick_lan` | `Waypoints::tick` | | --- | ---: | ---: | ---: | ---: | ---: | ---: | | main #1 | 42.9 | 35.9 | 110.9 | 6278 | 2756 | 389 | | this #1 | 31.0 | 22.9 | 87.9 | 6773 | 3069 | 108 | | main #2 | 44.7 | 32.3 | 127.1 | 7366 | 3652 | 568 | | this #2 | 39.4 | 30.8 | 111.1 | 7217 | 3473 | 168 | `Waypoints::tick` is 3.5 times cheaper. The MSPT differences are within this machine's noise: the locator bar was 6–8 % of the tick. ## How tested Run on the Mac mini, on an integration commit of this PR and the entity tracking one (#841), rebased on main: ``` cargo fmt --all --check ok cargo clippy --workspace --all-targets -- -D warnings ok cargo test -p horizon-client --lib 864 passed, 0 failed PARITY_LOCAL_JOBS=4 python3 tools/parity.py --changed origin/main before the last rebase: 93 passed, 1 failed (tooltip_display: its harness wrote Python's `False`; fixed on main by #837, and it passes on main and here since) on the rebased commit: 95 passed, 0 failed (32 min) ``` `locator_bar` (the waypoint packets two vanilla clients receive from Horizon's server against vanilla's, exactly) passes, as do `lan`, `dedicated_server` and `server_dimension_players`, and the `lan::waypoints` unit tests. ## Needs Ludovic Nothing. 🤖 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-02 15:59:35 +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#2851
No description provided.