[PR #867] [MERGED] Mesh scheduling looks at dirty sections column by column #2871

Closed
opened 2026-11-02 15:59:45 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: perf/mesh-queue-columns


📝 Commits (1)

  • 2ec71e5 Mesh scheduling looks at dirty sections column by column

📊 Changes

2 files changed (+99 additions, -50 deletions)

View changed files

📝 crates/horizon-client/src/streaming.rs (+58 -49)
📝 crates/horizon-client/src/world.rs (+41 -1)

📄 Description

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

What

Mesh scheduling works through dirty sections one column at a time.

  • World::dirty_sections was a hash set of (x, sy, z). It is now DirtySections: per chunk column, a bitmask of its dirty sections.
  • Each frame, Streaming::update copied every dirty section into a list and, for each one, ran the chunk lookup, the view check and two per-column cache lookups (readiness, region), even when the whole column was still waiting for light. It now runs those checks once per column, then submits that column's sections. A column outside the view moves to waiting in one step.
  • Like vanilla's SectionRenderDispatcher, sections that can't be meshed yet don't cost a lookup each.

Why

At RD 32 while exploring, the brief measured about 1.3 ms per frame spent rescanning waiting sections. In my runs, up to 12,000 dirty sections (about 500 columns) were waiting at once, each checked every frame.

Before / after

Mac mini, RD 32, the same 60 s flight as the light PR, probe spans, two ABBA pairs. The machine was shared with other sessions (load ~100), so whole-frame numbers are noisy.

ms per frame before after
mesh scheduling, flying (2 runs) 0.62 / 0.72 0.36 / 0.22
mesh scheduling, at rest with ~12,000 sections waiting 0.30–0.91 0.06–0.22

Whole frame in the same flights (FPS / CPU ms): before 38.2 / 23.5 and 34.5 / 25.7, after 29.4 / 30.0 (a load spike from another session) and 38.5 / 22.3. At this RD the bigger costs in a frame are elsewhere: renderer encode about 3–4 ms, submit about 3–5 ms, and mob ticks.

Which sections get meshed, and when, is unchanged. They go through the same readiness check, get the same job priority (distance, plus the first-mesh bonus) and the same meshed and sequence bookkeeping.

How tested (self-check)

On one integration commit of the three PRs (perf/compact-terrain-vertex, perf/light-dirty-sections, perf/mesh-queue-columns) on origin/main e508a5ce, Mac mini:

cargo fmt --all --check                                        ok
cargo clippy --workspace --all-targets -- -D warnings          ok, no warnings
cargo test -p horizon-client --lib                             870 passed, 0 failed, 11 ignored
cargo build -p horizon-client --bin horizon-client             ok
tools/parity.py --changed origin/main                          95 of 95 passed, 0 failed (155.9 min)

The harnesses covering the changed code passed: section_mesh, translucency and light. tooltip_display and mob_ai, which fail on main, also passed here. origin/main has moved since then (#859, #860); neither touches these files.

🤖 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/867 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/18/2026 **Status:** ✅ Merged **Merged:** 10/18/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/mesh-queue-columns` --- ### 📝 Commits (1) - [`2ec71e5`](https://github.com/horizon-rust/horizon/commit/2ec71e53875b9db9e0ed5fa2932c9f23ef47e89c) Mesh scheduling looks at dirty sections column by column ### 📊 Changes **2 files changed** (+99 additions, -50 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/streaming.rs` (+58 -49) 📝 `crates/horizon-client/src/world.rs` (+41 -1) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What Mesh scheduling works through dirty sections one column at a time. - `World::dirty_sections` was a hash set of `(x, sy, z)`. It is now `DirtySections`: per chunk column, a bitmask of its dirty sections. - Each frame, `Streaming::update` copied every dirty section into a list and, for each one, ran the chunk lookup, the view check and two per-column cache lookups (readiness, region), even when the whole column was still waiting for light. It now runs those checks once per column, then submits that column's sections. A column outside the view moves to `waiting` in one step. - Like vanilla's `SectionRenderDispatcher`, sections that can't be meshed yet don't cost a lookup each. ## Why At RD 32 while exploring, the brief measured about 1.3 ms per frame spent rescanning waiting sections. In my runs, up to 12,000 dirty sections (about 500 columns) were waiting at once, each checked every frame. ## Before / after Mac mini, RD 32, the same 60 s flight as the light PR, probe spans, two ABBA pairs. The machine was shared with other sessions (load ~100), so whole-frame numbers are noisy. | ms per frame | before | after | | --- | --- | --- | | mesh scheduling, flying (2 runs) | 0.62 / 0.72 | **0.36 / 0.22** | | mesh scheduling, at rest with ~12,000 sections waiting | 0.30–0.91 | **0.06–0.22** | Whole frame in the same flights (FPS / CPU ms): before 38.2 / 23.5 and 34.5 / 25.7, after 29.4 / 30.0 (a load spike from another session) and 38.5 / 22.3. At this RD the bigger costs in a frame are elsewhere: renderer encode about 3–4 ms, submit about 3–5 ms, and mob ticks. Which sections get meshed, and when, is unchanged. They go through the same readiness check, get the same job priority (distance, plus the first-mesh bonus) and the same `meshed` and sequence bookkeeping. ## How tested (self-check) On one integration commit of the three PRs (perf/compact-terrain-vertex, perf/light-dirty-sections, perf/mesh-queue-columns) on origin/main `e508a5ce`, Mac mini: ``` cargo fmt --all --check ok cargo clippy --workspace --all-targets -- -D warnings ok, no warnings cargo test -p horizon-client --lib 870 passed, 0 failed, 11 ignored cargo build -p horizon-client --bin horizon-client ok tools/parity.py --changed origin/main 95 of 95 passed, 0 failed (155.9 min) ``` The harnesses covering the changed code passed: section_mesh, translucency and light. tooltip_display and mob_ai, which fail on main, also passed here. origin/main has moved since then (#859, #860); neither touches these files. 🤖 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-02 15:59:45 +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#2871
No description provided.