[PR #871] [MERGED] Locator bar: look up each connection and its two players once #2872

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

📋 Pull Request Information

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

Base: main ← Head: perf/waypoint-pairs


📝 Commits (1)

  • 8bf73f8 Locator bar: look up each connection and its two players once

📊 Changes

1 file changed (+42 additions, -54 deletions)

View changed files

📝 crates/horizon-client/src/lan/waypoints.rs (+42 -54)

📄 Description

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

What

Waypoints::tick (the locator bar, ServerWaypointManager) is still one of the biggest parts of tick_lan with many players after #842: a moving player updates its connection with every other player three times a tick (updateWaypoint, then updatePlayer at the position change and again at ServerChunkCache.move), about 4,800 update_or_create calls a tick at 40 players. Each one looked its connection up twice (the receiver's row and a scan of it) and its two players up four to six times.

Now update_or_create finds the connection's place once and resolves the source and receiver once, then checks (isBroken), updates or remakes the connection in place; make, broken and update take the two players. A connection to a player who isn't in the level is still broken, so it is still remade or removed as before. The calls, their order and every packet are unchanged.

Measured

Mac mini M4 Pro, busy and shared, alternating runs; the same setup as #864 (flat world, 40 walking bots, 570 entities around spawn, /tick query every 5 s for 60 s, sample of the engine for 20 s).

run MSPT avg P50 P95 tick_lan samples Waypoints::tick share of tick_lan
main #1 26.4 18.3 77.8 1062 139 13.1 %
this #1 22.8 14.0 80.9 1424 89 6.3 %
main #2 27.9 14.8 106.3 1408 176 12.5 %
this #2 45.3 32.9 134.3 2085 218 10.5 %

The machine's load swung between runs (this #2 ran in the busiest stretch), so the shares are the number to read.

In-process timing of Waypoints::tick alone (40 players walking within 48 blocks, some jumping 200 blocks every 400 ticks so azimuth and chunk connections are used too; 3000 ticks, median per tick; a temporary test not in this PR): main 166 µs, this 111–112 µs (−33 %), with the same 530,834 packets and the same hash of their bytes and connections.

How tested

On 8bf73f89 (rebased on 7b8d8a60):

cargo fmt --all --check                                          ok
cargo clippy --workspace --all-targets -- -D warnings            ok
cargo test -p horizon-client --lib                               867 passed, 0 failed
PARITY_LOCAL_JOBS=2 python3 tools/parity.py locator_bar lan dedicated_server server_dimension_players
                                                                 4 passed, 0 failed (24.9 min)

parity.py --changed origin/main selects 95 harnesses for any change in lan/; locator_bar (with lan, dedicated_server and server_dimension_players) covers this, and CI parity covers the rest. Independent of #864: either can merge first.

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/871 **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-pairs` --- ### 📝 Commits (1) - [`8bf73f8`](https://github.com/horizon-rust/horizon/commit/8bf73f89d4aa89cb4f16617a2201c4e8f497a7d5) Locator bar: look up each connection and its two players once ### 📊 Changes **1 file changed** (+42 additions, -54 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/lan/waypoints.rs` (+42 -54) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What `Waypoints::tick` (the locator bar, ServerWaypointManager) is still one of the biggest parts of `tick_lan` with many players after #842: a moving player updates its connection with every other player three times a tick (`updateWaypoint`, then `updatePlayer` at the position change and again at `ServerChunkCache.move`), about 4,800 `update_or_create` calls a tick at 40 players. Each one looked its connection up twice (the receiver's row and a scan of it) and its two players up four to six times. Now `update_or_create` finds the connection's place once and resolves the source and receiver once, then checks (`isBroken`), updates or remakes the connection in place; `make`, `broken` and `update` take the two players. A connection to a player who isn't in the level is still broken, so it is still remade or removed as before. The calls, their order and every packet are unchanged. ## Measured Mac mini M4 Pro, busy and shared, alternating runs; the same setup as #864 (flat world, 40 walking bots, 570 entities around spawn, `/tick query` every 5 s for 60 s, `sample` of the engine for 20 s). | run | MSPT avg | P50 | P95 | `tick_lan` samples | `Waypoints::tick` | share of `tick_lan` | | --- | ---: | ---: | ---: | ---: | ---: | ---: | | main #1 | 26.4 | 18.3 | 77.8 | 1062 | 139 | 13.1 % | | this #1 | 22.8 | 14.0 | 80.9 | 1424 | 89 | 6.3 % | | main #2 | 27.9 | 14.8 | 106.3 | 1408 | 176 | 12.5 % | | this #2 | 45.3 | 32.9 | 134.3 | 2085 | 218 | 10.5 % | The machine's load swung between runs (this #2 ran in the busiest stretch), so the shares are the number to read. In-process timing of `Waypoints::tick` alone (40 players walking within 48 blocks, some jumping 200 blocks every 400 ticks so azimuth and chunk connections are used too; 3000 ticks, median per tick; a temporary test not in this PR): **main 166 µs, this 111–112 µs** (−33 %), with the same 530,834 packets and the same hash of their bytes and connections. ## How tested On 8bf73f89 (rebased on 7b8d8a60): ``` cargo fmt --all --check ok cargo clippy --workspace --all-targets -- -D warnings ok cargo test -p horizon-client --lib 867 passed, 0 failed PARITY_LOCAL_JOBS=2 python3 tools/parity.py locator_bar lan dedicated_server server_dimension_players 4 passed, 0 failed (24.9 min) ``` `parity.py --changed origin/main` selects 95 harnesses for any change in `lan/`; `locator_bar` (with `lan`, `dedicated_server` and `server_dimension_players`) covers this, and CI parity covers the rest. Independent of #864: either can merge first. ## 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:45 +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#2872
No description provided.