[PR #2090] [MERGED] Teleports free their dropped columns off the frame and in batches #3998

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

📋 Pull Request Information

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

Base: main ← Head: perf/teleport-drop-off-frame


📝 Commits (1)

  • 08f4fd5 Teleports free their dropped columns off the frame and in batches

📊 Changes

6 files changed (+174 additions, -36 deletions)

View changed files

📝 crates/horizon-client/src/chunk.rs (+14 -0)
📝 crates/horizon-client/src/game.rs (+1 -5)
📝 crates/horizon-client/src/game/remote.rs (+11 -10)
📝 crates/horizon-client/src/gfx.rs (+42 -13)
📝 crates/horizon-client/src/gfx/arena.rs (+87 -0)
📝 crates/horizon-client/src/gfx/occlusion.rs (+19 -8)

📄 Description

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

A long teleport, or a storage that moves more than its own size, drops every loaded column in one frame: 3,725 columns at RD 32. That frame first freed every column's sections. Then it removed each section from the renderer one at a time, with a few SipHash lookups per section and a free-list tree update for each mesh range. Players feel this as a stall on every teleport and every dimension change.

Change

  • The dropped columns are freed on a short-lived thread of their own ("Chunk freeing"), only when there are at least 64. The same goes for a left dimension's whole chunk map.
  • Renderer::remove_columns removes whole columns:
    • One lookup per column for the tables kept by column (detail columns, occlusion).
    • The meshes' ranges go back to the arena in one sorted merge per page (FreeList::give_all), instead of a BTreeMap update for each range.
    • The per-section Renderer::remove and Occlusion::remove have no callers left and are deleted.
  • The renderer's block-entity and detail-column tables are FxHashMap (they were std SipHash maps).

Nothing changes in what is drawn or when. A column under distant LOD tiles still retires the same way.

Numbers

Mac mini (M4 Pro), RD 32, an explored world, server thread, CI load 50-90, 3 alternated runs. Each run teleports twice across 1,320 blocks, then goes to the Nether and back. Times come from HORIZON_SPIKES=6 spans that were temporary and are not committed.

main this PR
Frame that drops the columns 26.1-39.7 ms (6 teleports) 6.9-8.5 ms (6 teleports)
Entering the Nether 9.7-13.4 ms 4.0 ms, or under 6 ms (not logged)

What's left of the drop is the renderer's per-section bookkeeping (Resident slots, flat ids) and the storage's own forget.

Checks

  • tools/lan_e2e.py:
    • Host in-frame: chest, light, respawn, drops pass.
    • --server-thread: chest, portals, levels, distance, respawn pass. These cover dimension changes and view-distance changes.
  • New unit test gfx::arena::tests::many_ranges_given_at_once_coalesce_as_one_by_one: giving ranges at once leaves the same free list as giving them one by one, and freeing everything coalesces back to one range.

No label: players see shorter stalls but nothing new.

pr_ready (tools/pr_ready.py on ludovics-mac-mini, against origin/main at 88b7bfafc, 109 min 52 s)

Check Result
Scope ✅ 6 files, +174 −36
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (19 s)
clippy ✅ (2 min 19 s)
tests: horizon-client ✅ 1299 passed (8 min 16 s)
doc tests ✅ 0 passed (4 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ✅ 79 affected, 79 passed (98 min 25 s)
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 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/2090 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/teleport-drop-off-frame` --- ### 📝 Commits (1) - [`08f4fd5`](https://github.com/horizon-rust/horizon/commit/08f4fd5c8eafe7de5b27faf4d368dbe342d75831) Teleports free their dropped columns off the frame and in batches ### 📊 Changes **6 files changed** (+174 additions, -36 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/chunk.rs` (+14 -0) 📝 `crates/horizon-client/src/game.rs` (+1 -5) 📝 `crates/horizon-client/src/game/remote.rs` (+11 -10) 📝 `crates/horizon-client/src/gfx.rs` (+42 -13) 📝 `crates/horizon-client/src/gfx/arena.rs` (+87 -0) 📝 `crates/horizon-client/src/gfx/occlusion.rs` (+19 -8) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. A long teleport, or a storage that moves more than its own size, drops every loaded column in one frame: 3,725 columns at RD 32. That frame first freed every column's sections. Then it removed each section from the renderer one at a time, with a few SipHash lookups per section and a free-list tree update for each mesh range. Players feel this as a stall on every teleport and every dimension change. ### Change - The dropped columns are freed on a short-lived thread of their own ("Chunk freeing"), only when there are at least 64. The same goes for a left dimension's whole chunk map. - `Renderer::remove_columns` removes whole columns: - One lookup per column for the tables kept by column (detail columns, occlusion). - The meshes' ranges go back to the arena in one sorted merge per page (`FreeList::give_all`), instead of a `BTreeMap` update for each range. - The per-section `Renderer::remove` and `Occlusion::remove` have no callers left and are deleted. - The renderer's block-entity and detail-column tables are `FxHashMap` (they were `std` SipHash maps). Nothing changes in what is drawn or when. A column under distant LOD tiles still retires the same way. ### Numbers Mac mini (M4 Pro), RD 32, an explored world, server thread, CI load 50-90, 3 alternated runs. Each run teleports twice across 1,320 blocks, then goes to the Nether and back. Times come from `HORIZON_SPIKES=6` spans that were temporary and are not committed. | | main | this PR | |---|---|---| | Frame that drops the columns | 26.1-39.7 ms (6 teleports) | 6.9-8.5 ms (6 teleports) | | Entering the Nether | 9.7-13.4 ms | 4.0 ms, or under 6 ms (not logged) | What's left of the drop is the renderer's per-section bookkeeping (Resident slots, flat ids) and the storage's own forget. ### Checks - `tools/lan_e2e.py`: - Host in-frame: chest, light, respawn, drops pass. - `--server-thread`: chest, portals, levels, distance, respawn pass. These cover dimension changes and view-distance changes. - New unit test `gfx::arena::tests::many_ranges_given_at_once_coalesce_as_one_by_one`: giving ranges at once leaves the same free list as giving them one by one, and freeing everything coalesces back to one range. No label: players see shorter stalls but nothing new. **pr_ready** (`tools/pr_ready.py` on ludovics-mac-mini, against origin/main at 88b7bfafc, 109 min 52 s) | Check | Result | | --- | --- | | Scope | ✅ 6 files, +174 −36 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (19 s) | | clippy | ✅ (2 min 19 s) | | tests: horizon-client | ✅ 1299 passed (8 min 16 s) | | doc tests | ✅ 0 passed (4 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ✅ 79 affected, 79 passed (98 min 25 s) | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 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 04:13:54 +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#3998
No description provided.