[PR #6826] [MERGED] Sections keep only the kind of light that varies #7119

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

📋 Pull Request Information

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

Base: main ← Head: perf/light-compact


📝 Commits (1)

  • 714644f Sections keep only the kind of light that varies

📊 Changes

7 files changed (+199 additions, -138 deletions)

View changed files

📝 crates/horizon-client-render/src/chunk.rs (+140 -14)
📝 crates/horizon-client-render/src/light.rs (+11 -17)
📝 crates/horizon-client-render/src/mesher.rs (+2 -5)
📝 crates/horizon-client-render/src/mesher/reuse_tests.rs (+1 -0)
📝 crates/horizon-client-render/src/streaming.rs (+1 -8)
📝 crates/horizon-client/src/lan/chunks.rs (+38 -82)
📝 crates/horizon-client/src/save.rs (+6 -12)

📄 Description

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

Stacked on #6825 (the horizon-ctl memory census these numbers come from).

What

A section's packed light was either one value or 4,096 bytes (sky and block nibbles together). Most lit sections vary in only one of them: above ground there is no block light, below it the sky light is a single value. Light gets two more forms, Sky and Block, which keep that layer's nibbles (2,048 bytes, the size of a vanilla DataLayer) and one value for the other. compact() and the light engine's output pick the smallest form that holds the same values.

The server's chunk encoder no longer makes the two 2,048-byte DataLayers of each section ahead of time on its warm-up threads. #6421 already dropped them once sent. The encoder now writes the packet's layers straight from the section's light, which for the Sky and Block forms is already a DataLayer.

Each value of every section is the same as before, and packets are byte-identical: the encoder's cache tests and the save tests still pass unchanged.

A/B

playhorizon (Linux, 8 vCPU shared with other jobs, load 14-29), headless single player on the server thread, seed 1234, creative. Three rounds, each running the variants side by side; medians, and the direction of each round's pair. At RD 32 the window settled at 3,725 columns and the server at 4,761. Base: #6825 (main plus the census only).

before after Δ rounds
RSS, RD 16 702 MB 665 MB −37 MB 3/3 down
peak RSS, RD 16 712 MB 678 MB −34 MB 3/3 down
RSS, RD 32 1,078 MB 976 MB −102 MB 3/3 down
peak RSS, RD 32 1,082 MB 1,010 MB −72 MB 3/3 down
window's light, RD 16 / 32 21.5 / 72.8 MB 11.0 / 37.3 MB −49 % identical each round
server's light, RD 16 / 32 27.9 / 91.6 MB 14.3 / 47.1 MB −49 % identical each round
window's columns, RD 32 150.9 MB 115.5 MB −35.4 MB
server's columns, RD 32 191.2 MB 146.7 MB −44.5 MB

These include rdbt's #6421, which already stopped keeping layers once they are sent: this PR drops the layers made ahead by the warm-up threads too, and stores each section's light at half the size.

Checks

pr_ready --quick on playhorizon, run on the top of the stack (#6827, which contains this branch).

Check Result
Scope ⚠️ 21 files, +632 −132; 763 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅ (1 s)
Python tests ❌ 598 run, FAILED (failures=2, skipped=1) (2 min 54 s)
rustfmt ✅ (1 min 15 s)
clippy ✅ (9 min 19 s)
tests: horizon-client, horizon-client-lib, horizon-client-render, horizon-core, horizon-threads ✅ 3054 passed (45 min 27 s)
doc tests ✅ 0 passed (7 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 ➖ 146 affected, to run in CI (--quick): ambient_sound, armor_stand_frost, arrow, arrow_wind_charge, audio_attributes, auto_jump, blending, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal and 134 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)
  • Python tests: test_lab.GameEnvScreenTests fails twice because the host's runner environment sets VSCREEN. This stack touches no Python.
  • Parity: left to CI's parity job.

Since the measurements

The stack was rebased onto main after the runs. Main's mesher fast path (#6672) copies a section's light into the padded rows itself, and only knew the Uniform and Full forms. It now calls Light::copy_run, which copies Full as before and decodes the nibbles of the Sky and Block forms for that run (18 cells).

New test each_light_form_keeps_every_value_and_run. On the rebased head (Mac): cargo check of the client and client lib (bins and tests), clippy -D warnings on horizon-client-render, and its chunk, mesher and light tests (82 passed).

🤖 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/6826 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/light-compact` --- ### 📝 Commits (1) - [`714644f`](https://github.com/horizon-rust/horizon/commit/714644fac0af047f3924f3b814ba9f335774d3fe) Sections keep only the kind of light that varies ### 📊 Changes **7 files changed** (+199 additions, -138 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/chunk.rs` (+140 -14) 📝 `crates/horizon-client-render/src/light.rs` (+11 -17) 📝 `crates/horizon-client-render/src/mesher.rs` (+2 -5) 📝 `crates/horizon-client-render/src/mesher/reuse_tests.rs` (+1 -0) 📝 `crates/horizon-client-render/src/streaming.rs` (+1 -8) 📝 `crates/horizon-client/src/lan/chunks.rs` (+38 -82) 📝 `crates/horizon-client/src/save.rs` (+6 -12) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Stacked on #6825 (the `horizon-ctl memory` census these numbers come from). ## What A section's packed light was either one value or 4,096 bytes (sky and block nibbles together). Most lit sections vary in only one of them: above ground there is no block light, below it the sky light is a single value. `Light` gets two more forms, `Sky` and `Block`, which keep that layer's nibbles (2,048 bytes, the size of a vanilla `DataLayer`) and one value for the other. `compact()` and the light engine's output pick the smallest form that holds the same values. The server's chunk encoder no longer makes the two 2,048-byte `DataLayer`s of each section ahead of time on its warm-up threads. #6421 already dropped them once sent. The encoder now writes the packet's layers straight from the section's light, which for the `Sky` and `Block` forms is already a DataLayer. Each value of every section is the same as before, and packets are byte-identical: the encoder's cache tests and the save tests still pass unchanged. ## A/B playhorizon (Linux, 8 vCPU shared with other jobs, load 14-29), headless single player on the server thread, seed 1234, creative. Three rounds, each running the variants side by side; medians, and the direction of each round's pair. At RD 32 the window settled at 3,725 columns and the server at 4,761. Base: #6825 (main plus the census only). | | before | after | Δ | rounds | |---|---|---|---|---| | RSS, RD 16 | 702 MB | 665 MB | **−37 MB** | 3/3 down | | peak RSS, RD 16 | 712 MB | 678 MB | −34 MB | 3/3 down | | RSS, RD 32 | 1,078 MB | 976 MB | **−102 MB** | 3/3 down | | peak RSS, RD 32 | 1,082 MB | 1,010 MB | −72 MB | 3/3 down | | window's light, RD 16 / 32 | 21.5 / 72.8 MB | 11.0 / 37.3 MB | −49 % | identical each round | | server's light, RD 16 / 32 | 27.9 / 91.6 MB | 14.3 / 47.1 MB | −49 % | identical each round | | window's columns, RD 32 | 150.9 MB | 115.5 MB | −35.4 MB | | | server's columns, RD 32 | 191.2 MB | 146.7 MB | −44.5 MB | | These include rdbt's #6421, which already stopped keeping layers once they are sent: this PR drops the layers made ahead by the warm-up threads too, and stores each section's light at half the size. ## Checks `pr_ready --quick` on playhorizon, run on the top of the stack (#6827, which contains this branch). | Check | Result | | --- | --- | | Scope | ⚠️ 21 files, +632 −132; 763 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (1 s) | | Python tests | ❌ 598 run, FAILED (failures=2, skipped=1) (2 min 54 s) | | rustfmt | ✅ (1 min 15 s) | | clippy | ✅ (9 min 19 s) | | tests: horizon-client, horizon-client-lib, horizon-client-render, horizon-core, horizon-threads | ✅ 3054 passed (45 min 27 s) | | doc tests | ✅ 0 passed (7 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 | ➖ 146 affected, to run in CI (--quick): ambient_sound, armor_stand_frost, arrow, arrow_wind_charge, audio_attributes, auto_jump, blending, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal and 134 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | - **Python tests**: `test_lab.GameEnvScreenTests` fails twice because the host's runner environment sets `VSCREEN`. This stack touches no Python. - **Parity**: left to CI's parity job. ### Since the measurements The stack was rebased onto main after the runs. Main's mesher fast path (#6672) copies a section's light into the padded rows itself, and only knew the `Uniform` and `Full` forms. It now calls `Light::copy_run`, which copies `Full` as before and decodes the nibbles of the `Sky` and `Block` forms for that run (18 cells). New test `each_light_form_keeps_every_value_and_run`. On the rebased head (Mac): `cargo check` of the client and client lib (bins and tests), clippy `-D warnings` on horizon-client-render, and its chunk, mesher and light tests (82 passed). 🤖 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:34:14 +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#7119
No description provided.