[PR #6879] [CLOSED] Mesh the sections the camera sees first, as vanilla compiles only those #7168

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6879
Author: @ludovic111
Created: 11/2/2026
Status: ❌ Closed

Base: main ← Head: perf/mesh-view-first


📝 Commits (6)

  • 2d8126f Mesh the sections the camera sees first, as vanilla compiles only those
  • 7ed902b Test: stop once the inner columns are meshed (the edge ones never are)
  • b37404a Test: the world's columns are 24 sections; check sections in view against columns behind
  • afa453b Rank by section: a seen column's sections out of view wait like the columns behind
  • e216401 Test: sections finish in any order across the pool's workers
  • 97b19c8 Merge remote-tracking branch 'origin/main' into perf/mesh-view-first

📊 Changes

6 files changed (+311 additions, -10 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx.rs (+7 -0)
📝 crates/horizon-client-render/src/streaming.rs (+260 -8)
📝 crates/horizon-client-render/src/world.rs (+11 -0)
📝 crates/horizon-client/src/game.rs (+8 -0)
📝 tests/test_perf_bench.py (+16 -0)
📝 tools/perf_bench.py (+9 -2)

📄 Description

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

What

After a /tp (or a join), Horizon meshed every section of the render distance nearest first, in front of the camera or behind it, and tools/perf_bench.py waited for all of them. Vanilla compiles only what it sees: LevelExtractor.extract schedules compiles for LevelRenderer.visibleSections (dirty, with all neighbours), and hasRenderedAllSections, the thing vanilla's bench driver waits for, is SectionRenderDispatcher.isQueueEmpty (that compile queue, empty). Checked in the 26.3 client bytecode.

  • Streaming.view (CameraView: the last frame's frustum and the camera position, set each frame from view_frustum). A ready column splits into the sections the camera sees and the rest: the seen ones are picked and queued first, the rest wait in dirty_sections (DirtySections::take takes only what was submitted) and then queue behind (OUT_OF_VIEW). So a column's sections under ground or in the sky no longer go ahead of the seen sections of farther columns.
  • An update's mesh jobs go into the queue under one lock (submit_all), so workers take them in priority order instead of the order they were made.
  • status.streaming.meshing_in_view: the sections in view ready to mesh or meshing. perf_bench waits for those instead of every section when a build reports it, as vanilla's driver does. Older builds are measured as before.

Measured

Mac mini M4 Pro, perf_bench --server vanilla, RD 32, 1280x720 offscreen, the same pre-generated vanilla server world, games alternated, Mac load 7-16. Scene load after /tp (s):

village forest ocean mountain
vanilla 26.3 (r1, r2) 4.6, 4.6 3.1, 3.3 2.7, 3.9 4.5, 4.4
Horizon main (r1, r2) 8.3, 5.9 3.9, 4.7 4.3, 3.9 4.8, 4.6
this branch, first version (r1, r2) 5.3, 8.0 3.8, 5.2 4.3, 4.5 5.0, 13.9

No change above the noise: on a vanilla server the load is how long the columns take to arrive (64 per tick, the server's ceiling, which both clients ask for), not meshing. What changes is which terrain fills first: what the player looks at. fps unchanged (village 471-478 vs vanilla 140).

Tests

  • streaming::tests::sections_in_the_camera_view_mesh_before_those_behind_it (real resources; skips without .local, as tall_column does): 15x15 remote columns around a camera looking east; every section in view meshes before any out of view (up to what the pool's other workers held), and meshing_in_view falls to 0 while sections behind still mesh. Passed 7 runs out of 7 on playhorizon.
  • tests/test_perf_bench.py: a build that reports meshing_in_view is loaded once the sections in view are; without it, when every section is.

pr_ready (tools/pr_ready.py --quick on playhorizon, against origin/main at 7e6cbea1a, 10 min 37 s)

Check Result
Scope ✅ 6 files, +311 −10
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 610 passed (1 min 0 s)
rustfmt ✅ (12 s)
clippy ✅ (2 min 39 s)
tests: horizon-client, horizon-client-render ✅ 1677 passed (6 min 24 s)
doc tests ✅ 0 passed (4 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 ➖ 137 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 125 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The horizon-client and horizon-client-render tests ran with RUST_TEST_THREADS=1: GPU tests crash in parallel on playhorizon's llvmpipe.

Part of the client perf 20x wave (perf-mesh).

🤖 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/6879 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 11/2/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `perf/mesh-view-first` --- ### 📝 Commits (6) - [`2d8126f`](https://github.com/horizon-rust/horizon/commit/2d8126fbca2e94a41697ad4a103611abfcc9c9e6) Mesh the sections the camera sees first, as vanilla compiles only those - [`7ed902b`](https://github.com/horizon-rust/horizon/commit/7ed902b518bca763d80870dd3fe25e5c0c8c47df) Test: stop once the inner columns are meshed (the edge ones never are) - [`b37404a`](https://github.com/horizon-rust/horizon/commit/b37404afd8ff907397e423ecdc69839bceba7611) Test: the world's columns are 24 sections; check sections in view against columns behind - [`afa453b`](https://github.com/horizon-rust/horizon/commit/afa453b431f9a1197456d1998e8163af07655532) Rank by section: a seen column's sections out of view wait like the columns behind - [`e216401`](https://github.com/horizon-rust/horizon/commit/e21640123d8a72f923b8bf970802bce5dbad4ddc) Test: sections finish in any order across the pool's workers - [`97b19c8`](https://github.com/horizon-rust/horizon/commit/97b19c82738e4a4e0e5735cdfec0a37553077255) Merge remote-tracking branch 'origin/main' into perf/mesh-view-first ### 📊 Changes **6 files changed** (+311 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx.rs` (+7 -0) 📝 `crates/horizon-client-render/src/streaming.rs` (+260 -8) 📝 `crates/horizon-client-render/src/world.rs` (+11 -0) 📝 `crates/horizon-client/src/game.rs` (+8 -0) 📝 `tests/test_perf_bench.py` (+16 -0) 📝 `tools/perf_bench.py` (+9 -2) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What After a `/tp` (or a join), Horizon meshed every section of the render distance nearest first, in front of the camera or behind it, and `tools/perf_bench.py` waited for all of them. Vanilla compiles only what it sees: `LevelExtractor.extract` schedules compiles for `LevelRenderer.visibleSections` (dirty, with all neighbours), and `hasRenderedAllSections`, the thing vanilla's bench driver waits for, is `SectionRenderDispatcher.isQueueEmpty` (that compile queue, empty). Checked in the 26.3 client bytecode. - `Streaming.view` (`CameraView`: the last frame's frustum and the camera position, set each frame from `view_frustum`). A ready column splits into the sections the camera sees and the rest: the seen ones are picked and queued first, the rest wait in `dirty_sections` (`DirtySections::take` takes only what was submitted) and then queue behind (`OUT_OF_VIEW`). So a column's sections under ground or in the sky no longer go ahead of the seen sections of farther columns. - An update's mesh jobs go into the queue under one lock (`submit_all`), so workers take them in priority order instead of the order they were made. - `status.streaming.meshing_in_view`: the sections in view ready to mesh or meshing. `perf_bench` waits for those instead of every section when a build reports it, as vanilla's driver does. Older builds are measured as before. ## Measured Mac mini M4 Pro, `perf_bench --server vanilla`, RD 32, 1280x720 offscreen, the same pre-generated vanilla server world, games alternated, Mac load 7-16. Scene load after `/tp` (s): | | village | forest | ocean | mountain | |---|---|---|---|---| | vanilla 26.3 (r1, r2) | 4.6, 4.6 | 3.1, 3.3 | 2.7, 3.9 | 4.5, 4.4 | | Horizon main (r1, r2) | 8.3, 5.9 | 3.9, 4.7 | 4.3, 3.9 | 4.8, 4.6 | | this branch, first version (r1, r2) | 5.3, 8.0 | 3.8, 5.2 | 4.3, 4.5 | 5.0, 13.9 | No change above the noise: on a vanilla server the load is how long the columns take to arrive (64 per tick, the server's ceiling, which both clients ask for), not meshing. What changes is which terrain fills first: what the player looks at. fps unchanged (village 471-478 vs vanilla 140). ## Tests - `streaming::tests::sections_in_the_camera_view_mesh_before_those_behind_it` (real resources; skips without `.local`, as `tall_column` does): 15x15 remote columns around a camera looking east; every section in view meshes before any out of view (up to what the pool's other workers held), and `meshing_in_view` falls to 0 while sections behind still mesh. Passed 7 runs out of 7 on playhorizon. - `tests/test_perf_bench.py`: a build that reports `meshing_in_view` is loaded once the sections in view are; without it, when every section is. **pr_ready** (`tools/pr_ready.py --quick` on playhorizon, against origin/main at 7e6cbea1a, 10 min 37 s) | Check | Result | | --- | --- | | Scope | ✅ 6 files, +311 −10 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 610 passed (1 min 0 s) | | rustfmt | ✅ (12 s) | | clippy | ✅ (2 min 39 s) | | tests: horizon-client, horizon-client-render | ✅ 1677 passed (6 min 24 s) | | doc tests | ✅ 0 passed (4 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 | ➖ 137 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 125 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The horizon-client and horizon-client-render tests ran with `RUST_TEST_THREADS=1`: GPU tests crash in parallel on playhorizon's llvmpipe. Part of the client perf 20x wave (perf-mesh). 🤖 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:35:11 +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#7168
No description provided.