[PR #6620] [MERGED] Splitscreen: list the monitors only while it is on, once a second #6988

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

📋 Pull Request Information

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

Base: main ← Head: perf/split-monitors-on-demand


📝 Commits (1)

  • f878821 Splitscreen: list the monitors only while it is on, once a second

📊 Changes

1 file changed (+14 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/game/split.rs (+14 -3)

📄 Description

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

Split::about_to_wait listed the monitors (available_monitors) every frame, whether splitscreen was on or not. On macOS each listing is a round trip to the window server (SLSGetActiveDisplayList). A sample of an RD 32 flight on an M4 Pro (main 1bd24e40) put it at 0.14-0.29 ms of every frame, 2-3 % of the main thread, while splitscreen was off.

Now monitors are listed only while splitscreen is on, or while a player window is still open, and at most once a second. Splitscreen places its windows from the list it reads when it turns on: screens_read starts at None, so the first frame reads it.

Measurements

Mac mini M4 Pro, 1080p offscreen, perf_bench scenes, RD 32, 12 s flights. The Mac is GPU-bound at 1080p and shared with other agents (load 40-80), so FPS doesn't move there. The figure that matters is the main thread's CPU per frame, from ps -M before and after each flight; it includes about_to_wait, which the frame cpu stat leaves out. ab1 = this PR + #6621 (structure block boxes), alternating with main in the same lock window:

scene main: main-thread ms/frame ab1 run 0 ab1 run 1 FPS main → ab1 p99 ms main → ab1
village 1.92 1.66 1.81 335 → 331 4.91 → 4.95
forest 2.07 1.81 1.92 166 → 166 8.29 → 7.99
ocean 2.03 1.93 1.95 212 → 206 6.96 → 6.85
mountain 2.67 2.42 2.46 189 → 190 7.48 → 7.40

That's about 0.1-0.25 ms less main-thread CPU per frame; load noise on this machine is ±10 %. The saving doesn't depend on render distance: one listing per frame, whatever the RD. I didn't measure RD 8/16. Nothing drawn changes, so no screenshot comparison.

Checks

pr_ready (tools/pr_ready.py --quick on playhorizon, against origin/main at dea6dea98, 51 min 7 s)

Check Result
Scope ✅ 1 files, +14 −3
Cargo.lock ✅ unchanged
Public tree ✅ (1 s)
Python tests ✅ 586 passed (1 min 19 s)
rustfmt ✅ (17 s)
clippy ✅ (8 min 46 s)
tests: horizon-client ❌ 1198 passed, 1 failed (40 min 37 s)
doc tests ✅ 0 passed (3 s)
Parity ➖ 19 affected, to run in CI (--quick)

The one failure, entities::armor_stand_motion_tests::a_tick_keeps_the_previous_position_for_interpolation, also fails on main where .local data is present (CI skips it). This change doesn't touch it.

Splitscreen PRs #6395/#6397 call refresh_monitors from their Setup screen themselves, so they keep fresh monitors there.

🤖 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/6620 **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/split-monitors-on-demand` --- ### 📝 Commits (1) - [`f878821`](https://github.com/horizon-rust/horizon/commit/f87882144e9589be72b23decb0311ca09bd6aad4) Splitscreen: list the monitors only while it is on, once a second ### 📊 Changes **1 file changed** (+14 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/split.rs` (+14 -3) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. `Split::about_to_wait` listed the monitors (`available_monitors`) every frame, whether splitscreen was on or not. On macOS each listing is a round trip to the window server (`SLSGetActiveDisplayList`). A `sample` of an RD 32 flight on an M4 Pro (main 1bd24e40) put it at **0.14-0.29 ms of every frame**, 2-3 % of the main thread, while splitscreen was off. Now monitors are listed only while splitscreen is on, or while a player window is still open, and at most once a second. Splitscreen places its windows from the list it reads when it turns on: `screens_read` starts at `None`, so the first frame reads it. ### Measurements Mac mini M4 Pro, 1080p offscreen, perf_bench scenes, RD 32, 12 s flights. The Mac is GPU-bound at 1080p and shared with other agents (load 40-80), so FPS doesn't move there. The figure that matters is the main thread's CPU per frame, from `ps -M` before and after each flight; it includes `about_to_wait`, which the frame `cpu` stat leaves out. `ab1` = this PR + #6621 (structure block boxes), alternating with main in the same lock window: | scene | main: main-thread ms/frame | ab1 run 0 | ab1 run 1 | FPS main → ab1 | p99 ms main → ab1 | |---|---|---|---|---|---| | village | 1.92 | 1.66 | 1.81 | 335 → 331 | 4.91 → 4.95 | | forest | 2.07 | 1.81 | 1.92 | 166 → 166 | 8.29 → 7.99 | | ocean | 2.03 | 1.93 | 1.95 | 212 → 206 | 6.96 → 6.85 | | mountain | 2.67 | 2.42 | 2.46 | 189 → 190 | 7.48 → 7.40 | That's about 0.1-0.25 ms less main-thread CPU per frame; load noise on this machine is ±10 %. The saving doesn't depend on render distance: one listing per frame, whatever the RD. I didn't measure RD 8/16. Nothing drawn changes, so no screenshot comparison. ### Checks **pr_ready** (`tools/pr_ready.py --quick` on playhorizon, against origin/main at dea6dea98, 51 min 7 s) | Check | Result | | --- | --- | | Scope | ✅ 1 files, +14 −3 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (1 s) | | Python tests | ✅ 586 passed (1 min 19 s) | | rustfmt | ✅ (17 s) | | clippy | ✅ (8 min 46 s) | | tests: horizon-client | ❌ 1198 passed, 1 failed (40 min 37 s) | | doc tests | ✅ 0 passed (3 s) | | Parity | ➖ 19 affected, to run in CI (--quick) | The one failure, `entities::armor_stand_motion_tests::a_tick_keeps_the_previous_position_for_interpolation`, also fails on main where `.local` data is present (CI skips it). This change doesn't touch it. Splitscreen PRs #6395/#6397 call `refresh_monitors` from their Setup screen themselves, so they keep fresh monitors there. 🤖 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:31:01 +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#6988
No description provided.