[PR #5751] [MERGED] Streaming: build the light views of proto chunks on the workers #6476

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

📋 Pull Request Information

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

Base: main ← Head: perf/light-views-on-workers


📝 Commits (1)

  • ae0ed11 Streaming: build the light views of proto chunks on the workers

📊 Changes

1 file changed (+55 additions, -18 deletions)

View changed files

📝 crates/horizon-client-render/src/streaming.rs (+55 -18)

📄 Description

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

To light a column of the last ring, a light job reads its neighbours past the area. It reads them as light views: block-only copies of their decorated proto chunks (vanilla lights its last FULL ring against neighbours at FEATURES). The server thread built these views itself, inside light_region, while it scheduled light. With 20 players moving, that meant about 8 views per tick, each one a full column copy.

Now the proto chunk is checked out to a worker for its view, the same way a save checks out its protos:

  • Worker side. A new Job::LightView builds the view there and sends the proto back with it (Done::LightView).
  • Waiting for the view. The light job waits in dirty_light and is scheduled once the view is back. That is at most a tick or two later, because the view job is queued just before the light job's own priority.
  • While checked out, the slot is Some(None), the state decoration and saves already use. Nothing drops it as far, decorates around it or saves it, and light_region_ready waits for it.
  • save(true) and poll_save wait for views in flight like they do for decorations, so no proto (or what decoration wrote into it) is missing from a save. busy() counts them.
  • unstick_light puts back in dirty_light a column whose region waits on a view.

The light itself is unchanged: same views, same regions, same light_chunk.

Measurement

playhorizon (EPYC, CPUs 0-3, exclusive), server_bench.py horizon, 20 mixed bots, 3 alternated rounds. Base is main 05f240102, test is this PR.

ms/tick round 1 round 2 round 3 median
streaming, main 4.53 4.51 4.53 4.53
streaming, this PR 3.42 3.47 3.46 3.46 (−24 %)
MSPT, main 26.59 26.80 26.20 26.59
MSPT, this PR 26.07 26.37 26.70 26.37

Before #5629 (light views copy blocks only), a sub-span measurement put the light-scheduling share of streaming at 1.45 ms per tick. This PR takes almost all of what was left of it off the server thread.

Checks

  • Streaming unit tests: pass.
  • forced_chunks, generation_saves, streaming_meshes integration tests: pass.
  • The 117 affected harnesses run in CI (run-parity).

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 05f240102, 6 min 43 s)

Check Result
Scope ✅ 1 files, +55 −18
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 511 passed (2 min 47 s)
rustfmt ✅ (15 s)
clippy ✅ (2 min 14 s)
tests: horizon-client-render ✅ 831 passed (43 s)
doc tests ✅ 0 passed (1 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 117 affected, to run in CI (--quick): ambient_sound, arrow, audio_attributes, auto_jump, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal, block_tint, block_transformer, breaking_model and 105 more
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/5751 **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/light-views-on-workers` --- ### 📝 Commits (1) - [`ae0ed11`](https://github.com/horizon-rust/horizon/commit/ae0ed11cafd066bc27a662576ae5e04980488036) Streaming: build the light views of proto chunks on the workers ### 📊 Changes **1 file changed** (+55 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/streaming.rs` (+55 -18) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. To light a column of the last ring, a light job reads its neighbours past the area. It reads them as *light views*: block-only copies of their decorated proto chunks (vanilla lights its last FULL ring against neighbours at FEATURES). The server thread built these views itself, inside `light_region`, while it scheduled light. With 20 players moving, that meant about 8 views per tick, each one a full column copy. Now the proto chunk is checked out to a worker for its view, the same way a save checks out its protos: - **Worker side.** A new `Job::LightView` builds the view there and sends the proto back with it (`Done::LightView`). - **Waiting for the view.** The light job waits in `dirty_light` and is scheduled once the view is back. That is at most a tick or two later, because the view job is queued just before the light job's own priority. - **While checked out,** the slot is `Some(None)`, the state decoration and saves already use. Nothing drops it as far, decorates around it or saves it, and `light_region_ready` waits for it. - **`save(true)` and `poll_save`** wait for views in flight like they do for decorations, so no proto (or what decoration wrote into it) is missing from a save. `busy()` counts them. - **`unstick_light`** puts back in `dirty_light` a column whose region waits on a view. The light itself is unchanged: same views, same regions, same `light_chunk`. ### Measurement playhorizon (EPYC, CPUs 0-3, exclusive), `server_bench.py` horizon, 20 mixed bots, 3 alternated rounds. Base is main 05f240102, test is this PR. | ms/tick | round 1 | round 2 | round 3 | median | |---|---|---|---|---| | `streaming`, main | 4.53 | 4.51 | 4.53 | 4.53 | | `streaming`, this PR | 3.42 | 3.47 | 3.46 | **3.46 (−24 %)** | | MSPT, main | 26.59 | 26.80 | 26.20 | 26.59 | | MSPT, this PR | 26.07 | 26.37 | 26.70 | 26.37 | Before #5629 (light views copy blocks only), a sub-span measurement put the light-scheduling share of `streaming` at 1.45 ms per tick. This PR takes almost all of what was left of it off the server thread. ### Checks - Streaming unit tests: pass. - `forced_chunks`, `generation_saves`, `streaming_meshes` integration tests: pass. - The 117 affected harnesses run in CI (run-parity). **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 05f240102, 6 min 43 s) | Check | Result | | --- | --- | | Scope | ✅ 1 files, +55 −18 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 511 passed (2 min 47 s) | | rustfmt | ✅ (15 s) | | clippy | ✅ (2 min 14 s) | | tests: horizon-client-render | ✅ 831 passed (43 s) | | doc tests | ✅ 0 passed (1 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 117 affected, to run in CI (--quick): ambient_sound, arrow, audio_attributes, auto_jump, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal, block_tint, block_transformer, breaking_model and 105 more | | 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 06:21:15 +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#6476
No description provided.