[PR #7260] [MERGED] Relight big edit batches on the light workers (/fill: 64 ms → 7 ms frame) #7448

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

📋 Pull Request Information

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

Base: main ← Head: perf/fill-relight-workers


📝 Commits (1)

  • ab75989 Relight big edit batches on the light workers

📊 Changes

1 file changed (+82 additions, -0 deletions)

View changed files

📝 crates/horizon-client-render/src/streaming.rs (+82 -0)

📄 Description

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

What

A /fill of 64×64×16 (two fills, the default block limit) arrives on the client as ~32k single block changes in one frame. Streaming::relight_edits relit each one in place: clearing the volume in the air relit the sky below it, 40–60 ms in one frame (lt_sky 43 ms, lt_sources 9, lt_columns 5).

Past 4096 changed cells (one section's worth), the columns the edits touch now get full light jobs on the workers through dirty_light, as World::edit_runs already does for chunk-sized edits. The sections wait for those jobs before they are meshed again. A column is handed over only when it and its 8 neighbours can be lit whole; edits in other columns (the edge of the loaded area) stay in place. Without that split, a few stray edits at the render-distance edge pulled the whole batch back into the frame.

Smaller batches (a player placing blocks, TNT, fluids, pistons) keep the in-place path.

A/B (Mac mini M4 Pro, RD 12, 1920×1080 offscreen, server-thread single player, 3 alternated pairs, pacing_bench fill scenario)

main e8b55fbe55 this PR
fill: worst frame 47.5 / 48.7 / 44.1 ms 6.0 / 7.2 / 6.9 ms
clear: worst frame 63.9 / 39.6 / 51.2 ms 6.1 / 7.2 / 7.6 ms
0.1% low 50.9 / 52.1 / 52.9 FPS 210.6 / 175.8 / 184.0 FPS
1% low 202 / 207 / 203 FPS 303 / 292 / 298 FPS
frames > 33 ms 2 / 2 / 2 0 / 0 / 0
TNT ×50: worst frame 4.4 / 4.8 / 4.2 ms 4.5 / 5.0 / 4.5 ms

As a guest on a dedicated server (same build, 2 alternated pairs): fill 41.9 / 43.1 → 4.4 / 5.6 ms, clear 49.8 / 45.6 → 4.7 / 3.8 ms, 0.1% low 38–68 → 228–268 FPS.

Checks

  • Light after the fill and after the clear (horizon-ctl light over three slices through the volume): identical hashes on main and this PR.
  • Screenshots 100 ms after the fill and the clear: the change is on screen on both sides; no visible delay.
  • A light job started before the edits is dropped by its sequence number when the new one is queued, so the stale result is never applied.
  • Test whole_relights_cover_the_edited_columns_and_their_neighbours: the columns handed over, the edits kept in the frame next to a column that can't be lit, negative coordinates.

pr_ready

pr_ready (tools/pr_ready.py --quick on playhorizon, against origin/main at 0f0fa62dc, 8 min 54 s)

Check Result
Scope ✅ 1 files, +82 −0
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 612 passed (1 min 7 s)
rustfmt ✅ (14 s)
clippy ✅ (3 min 4 s)
tests: horizon-client-render ✅ 1162 passed (3 min 34 s)
doc tests ✅ 0 passed (1 s)
content root tests ➖ content root untouched
mod API up to date ➖ native hooks untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 141 affected, to run in CI (--quick): ambient_sound, anvil_turtle_egg, armor_stand_frost, armor_stand_turtle_egg, arrow, arrow_wind_charge, audio_attributes, auto_jump, blending, block_entity_anim, block_entity_render, block_entity_tickers and 129 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/7260 **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/fill-relight-workers` --- ### 📝 Commits (1) - [`ab75989`](https://github.com/horizon-rust/horizon/commit/ab7598908cf802801cb08d757e4bb4d618d84ce3) Relight big edit batches on the light workers ### 📊 Changes **1 file changed** (+82 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/streaming.rs` (+82 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What A `/fill` of 64×64×16 (two fills, the default block limit) arrives on the client as ~32k single block changes in one frame. `Streaming::relight_edits` relit each one in place: clearing the volume in the air relit the sky below it, 40–60 ms in one frame (`lt_sky` 43 ms, `lt_sources` 9, `lt_columns` 5). Past 4096 changed cells (one section's worth), the columns the edits touch now get full light jobs on the workers through `dirty_light`, as `World::edit_runs` already does for chunk-sized edits. The sections wait for those jobs before they are meshed again. A column is handed over only when it and its 8 neighbours can be lit whole; edits in other columns (the edge of the loaded area) stay in place. Without that split, a few stray edits at the render-distance edge pulled the whole batch back into the frame. Smaller batches (a player placing blocks, TNT, fluids, pistons) keep the in-place path. ## A/B (Mac mini M4 Pro, RD 12, 1920×1080 offscreen, server-thread single player, 3 alternated pairs, `pacing_bench` fill scenario) | | main e8b55fbe55 | this PR | |---|---|---| | fill: worst frame | 47.5 / 48.7 / 44.1 ms | 6.0 / 7.2 / 6.9 ms | | clear: worst frame | 63.9 / 39.6 / 51.2 ms | 6.1 / 7.2 / 7.6 ms | | 0.1% low | 50.9 / 52.1 / 52.9 FPS | 210.6 / 175.8 / 184.0 FPS | | 1% low | 202 / 207 / 203 FPS | 303 / 292 / 298 FPS | | frames > 33 ms | 2 / 2 / 2 | 0 / 0 / 0 | | TNT ×50: worst frame | 4.4 / 4.8 / 4.2 ms | 4.5 / 5.0 / 4.5 ms | As a guest on a dedicated server (same build, 2 alternated pairs): fill 41.9 / 43.1 → 4.4 / 5.6 ms, clear 49.8 / 45.6 → 4.7 / 3.8 ms, 0.1% low 38–68 → 228–268 FPS. ## Checks - Light after the fill and after the clear (`horizon-ctl light` over three slices through the volume): identical hashes on main and this PR. - Screenshots 100 ms after the fill and the clear: the change is on screen on both sides; no visible delay. - A light job started before the edits is dropped by its sequence number when the new one is queued, so the stale result is never applied. - Test `whole_relights_cover_the_edited_columns_and_their_neighbours`: the columns handed over, the edits kept in the frame next to a column that can't be lit, negative coordinates. ## pr_ready **pr_ready** (`tools/pr_ready.py --quick` on playhorizon, against origin/main at 0f0fa62dc, 8 min 54 s) | Check | Result | | --- | --- | | Scope | ✅ 1 files, +82 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 612 passed (1 min 7 s) | | rustfmt | ✅ (14 s) | | clippy | ✅ (3 min 4 s) | | tests: horizon-client-render | ✅ 1162 passed (3 min 34 s) | | doc tests | ✅ 0 passed (1 s) | | content root tests | ➖ content root untouched | | mod API up to date | ➖ native hooks untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 141 affected, to run in CI (--quick): ambient_sound, anvil_turtle_egg, armor_stand_frost, armor_stand_turtle_egg, arrow, arrow_wind_charge, audio_attributes, auto_jump, blending, block_entity_anim, block_entity_render, block_entity_tickers and 129 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:39:42 +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#7448
No description provided.