[PR #3815] [MERGED] Streaming: build each proto chunk's light view once #5230

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

📋 Pull Request Information

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

Base: main ← Head: perf/light-view-cache


📝 Commits (1)

  • 2286b52 Streaming: build each proto chunk's light view once

📊 Changes

2 files changed (+73 additions, -4 deletions)

View changed files

📝 crates/horizon-client-render/src/streaming.rs (+26 -4)
📝 crates/horizon-client/tests/generation_saves.rs (+47 -0)

📄 Description

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

What

A column at the edge of the loaded area lights against its decorated neighbours past the area (vanilla lights its last FULL ring against neighbours at FEATURES), so Streaming::light_region turns those proto chunks into columns with ChunkGenerator::light_view, on the tick thread. It did that again for every light job, and for every retry of a column still waiting on its last neighbour: a dirty column is retried each tick and built the views of the protos it met before the missing neighbour each time.

Counted on a dedicated server with 50 mixed bots (temporary counters, not in this PR): 59 220 views built for 5 345 distinct proto chunks (each ~11 times), for 15 511 light jobs, with 882 055 failed light_region calls.

This keeps each view in Streaming::light_views until its proto is checked out (decoration, save, finish), replaced or removed, so it is built once per proto state. The views are the same columns as before, so light is unchanged.

Measurements (dedicated server, Mac mini M4 Pro, fast profile, view/simulation distance 10)

The Mac mini was shared and busy (load average 50 to 180 on 14 cores; bots on the same machine), so the evidence is the streaming span (HORIZON_SPIKES=0, mean per tick) in interleaved A/B runs of origin/main 7e42cc8ec and this branch, plus sample of the tick thread:

run streaming ms/tick main → this tick MSPT main → this RSS MB main → this
25 explore bots at 8 blocks/s, pass 1 10.43 → 4.10 20.2 → 21.2 1385 → 1387
25 explore bots at 8 blocks/s, pass 2 24.32 → 3.25 32.2 → 17.9 1366 → 1286
50 mixed bots 17.1 → 7.3 39.9 → 38.6 1662 → 1825 (1253 vs 1430 mobs)
100 mixed bots 8.6 → 5.8 46.9 → 53.7 (352 vs 1767 mobs, not equal work) 1863 → 2089

sample at 100 bots: light_region 2.5 % → 0.3 % of the tick thread; in the first 100-bot profile (main 3c9bb38e8) light_region → light_view → VanillaTerrain::column was 18.7 % of it. Total MSPT moves with the mob count and the machine's load: only the streaming span is comparable between runs. RSS is unchanged at equal work (the explore rows).

Tests

  • New proto_chunks_are_viewed_once_per_state (crates/horizon-client/tests/generation_saves.rs): the test generator records every light view; walking the player across the area, no proto chunk is viewed twice in the same state. It fails on main ("a proto chunk was viewed again unchanged") and passes here.

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 7e42cc8ec, 43 min 55 s)

Check Result
Scope ✅ 2 files, +73 −4
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 416 passed (1 min 44 s)
rustfmt ✅ (11 s)
clippy ✅ (13 min 3 s)
tests: horizon-client, horizon-client-render ✅ 1358 passed (22 min 14 s)
doc tests ✅ 0 passed (4 min 59 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 ➖ 107 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_transformer, breaking_model, camera and 95 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Harnesses: a local run of dedicated_server, light, server_entities, server_world_gen, world_reopen, world_spawn and server_dimension_players did not get past building the probes within an hour (the Mac mini was at load ~100), so the 107 affected harnesses run in CI (label run-parity).

Part of roadmap item server-tick (servers at 20 TPS with 50 to 100 players). Nothing needs Ludovic.

🤖 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/3815 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/light-view-cache` --- ### 📝 Commits (1) - [`2286b52`](https://github.com/horizon-rust/horizon/commit/2286b52f010df4cfa4d1d7c0257ee81588650d2d) Streaming: build each proto chunk's light view once ### 📊 Changes **2 files changed** (+73 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/streaming.rs` (+26 -4) 📝 `crates/horizon-client/tests/generation_saves.rs` (+47 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What A column at the edge of the loaded area lights against its decorated neighbours past the area (vanilla lights its last FULL ring against neighbours at FEATURES), so `Streaming::light_region` turns those proto chunks into columns with `ChunkGenerator::light_view`, on the tick thread. It did that again for every light job, and for every retry of a column still waiting on its last neighbour: a dirty column is retried each tick and built the views of the protos it met before the missing neighbour each time. Counted on a dedicated server with 50 `mixed` bots (temporary counters, not in this PR): **59 220 views built for 5 345 distinct proto chunks** (each ~11 times), for 15 511 light jobs, with 882 055 failed `light_region` calls. This keeps each view in `Streaming::light_views` until its proto is checked out (decoration, save, finish), replaced or removed, so it is built once per proto state. The views are the same columns as before, so light is unchanged. ## Measurements (dedicated server, Mac mini M4 Pro, `fast` profile, view/simulation distance 10) The Mac mini was shared and busy (load average 50 to 180 on 14 cores; bots on the same machine), so the evidence is the `streaming` span (`HORIZON_SPIKES=0`, mean per tick) in interleaved A/B runs of origin/main 7e42cc8ec and this branch, plus `sample` of the tick thread: | run | `streaming` ms/tick main → this | tick MSPT main → this | RSS MB main → this | |---|---|---|---| | 25 `explore` bots at 8 blocks/s, pass 1 | 10.43 → 4.10 | 20.2 → 21.2 | 1385 → 1387 | | 25 `explore` bots at 8 blocks/s, pass 2 | 24.32 → 3.25 | 32.2 → 17.9 | 1366 → 1286 | | 50 `mixed` bots | 17.1 → 7.3 | 39.9 → 38.6 | 1662 → 1825 (1253 vs 1430 mobs) | | 100 `mixed` bots | 8.6 → 5.8 | 46.9 → 53.7 (352 vs 1767 mobs, not equal work) | 1863 → 2089 | `sample` at 100 bots: `light_region` 2.5 % → 0.3 % of the tick thread; in the first 100-bot profile (main 3c9bb38e8) `light_region` → `light_view` → `VanillaTerrain::column` was 18.7 % of it. Total MSPT moves with the mob count and the machine's load: only the streaming span is comparable between runs. RSS is unchanged at equal work (the explore rows). ## Tests - New `proto_chunks_are_viewed_once_per_state` (crates/horizon-client/tests/generation_saves.rs): the test generator records every light view; walking the player across the area, no proto chunk is viewed twice in the same state. It fails on main ("a proto chunk was viewed again unchanged") and passes here. **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 7e42cc8ec, 43 min 55 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +73 −4 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 416 passed (1 min 44 s) | | rustfmt | ✅ (11 s) | | clippy | ✅ (13 min 3 s) | | tests: horizon-client, horizon-client-render | ✅ 1358 passed (22 min 14 s) | | doc tests | ✅ 0 passed (4 min 59 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 | ➖ 107 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_transformer, breaking_model, camera and 95 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Harnesses: a local run of dedicated_server, light, server_entities, server_world_gen, world_reopen, world_spawn and server_dimension_players did not get past building the probes within an hour (the Mac mini was at load ~100), so the 107 affected harnesses run in CI (label `run-parity`). Part of roadmap item `server-tick` (servers at 20 TPS with 50 to 100 players). Nothing needs Ludovic. 🤖 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 05:11:08 +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#5230
No description provided.