[PR #254] [MERGED] Battery mode: an opt-in 60 FPS cap (30 in menus or unfocused) and half the worker threads #2441

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

📋 Pull Request Information

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

Base: main ← Head: feat/perf-battery-mode


📝 Commits (2)

  • 0229615 Battery mode: an opt-in frame cap and fewer worker threads
  • dbc8582 Battery mode: a one-line description

📊 Changes

4 files changed (+67 additions, -20 deletions)

View changed files

📝 crates/horizon-client/src/game/options.rs (+4 -1)
📝 crates/horizon-client/src/graphics.rs (+35 -3)
📝 crates/horizon-client/src/graphics_ui.rs (+25 -15)
📝 docs/graphics.md (+3 -1)

📄 Description

What

Options → Graphics → Performance → Battery Mode (Horizon setting, batteryMode in horizon-graphics.txt, off by default): at most 60 FPS in a world, 30 in menus without a world or while another window has focus, and half the automatic worker threads. It lowers the frame cap only (never raises one the player set), so what frames show and the 20 ticks per second don't change. Documented in docs/graphics.md.

Why

Laptops and handhelds (Steam Deck, MacBook): Horizon renders hundreds of FPS by default, which burns battery for nothing. Part of the benchmark work (card#23): power and battery drain are among the measured metrics.

Measured (Mac mini M4 Pro, offscreen because the session is locked, so the window is unfocused and the 30 cap applies; machine shared with CI, load average 21–64)

Village at RD12 held 30 s after load, horizon-ctl bench 30, the game's own CPU time from ps, two runs each:

avg FPS p50 frame game CPU
off 741 / 737 0.90 / 0.94 ms 261% / 238% of a core
on 25.6 / 25.8 40.6 / 40.5 ms 61% / 63% of a core

CPU use falls by about 75%. The cap gives 25.7 FPS rather than 30: the existing frame limiter sleeps longer than asked in an unfocused, App-Napped process (vanilla's limiter does the same thing there). World and village load times were within run-to-run noise (25–42 s vs 33–36 s; the load average swung from 21 to 64). Not measured here: the 60 FPS in-focus cap (needs an unlocked screen; battery_mode_only_lowers_the_frame_cap covers the rule) and wall power (needs an idle machine or a laptop).

Self-check

cargo fmt --all -- --check                               ok
cargo clippy --workspace --all-targets -- -D warnings    ok
cargo test -p horizon-client                             578 passed (fixed: the row's description was over one line)
python3 tools/parity.py options frame_limiter            2 passed
python3 tools/parity.py section_mesh light              2 passed (Mac mini)

Needs Ludovic

Nothing to decide. A laptop run (MacBook when it's awake, the ThinkPad) would give a battery-drain figure.

🤖 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/254 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/perf-battery-mode` --- ### 📝 Commits (2) - [`0229615`](https://github.com/horizon-rust/horizon/commit/02296155602906f31224be9c065970326ee560ed) Battery mode: an opt-in frame cap and fewer worker threads - [`dbc8582`](https://github.com/horizon-rust/horizon/commit/dbc85822c1654ab7f1b47be329e22e1dcc2c07ec) Battery mode: a one-line description ### 📊 Changes **4 files changed** (+67 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/options.rs` (+4 -1) 📝 `crates/horizon-client/src/graphics.rs` (+35 -3) 📝 `crates/horizon-client/src/graphics_ui.rs` (+25 -15) 📝 `docs/graphics.md` (+3 -1) </details> ### 📄 Description ## What Options → Graphics → Performance → **Battery Mode** (Horizon setting, `batteryMode` in `horizon-graphics.txt`, **off by default**): at most 60 FPS in a world, 30 in menus without a world or while another window has focus, and half the automatic worker threads. It lowers the frame cap only (never raises one the player set), so what frames show and the 20 ticks per second don't change. Documented in docs/graphics.md. ## Why Laptops and handhelds (Steam Deck, MacBook): Horizon renders hundreds of FPS by default, which burns battery for nothing. Part of the benchmark work (card#23): power and battery drain are among the measured metrics. ## Measured (Mac mini M4 Pro, offscreen because the session is locked, so the window is unfocused and the 30 cap applies; machine shared with CI, load average 21–64) Village at RD12 held 30 s after load, `horizon-ctl bench 30`, the game's own CPU time from `ps`, two runs each: | | avg FPS | p50 frame | game CPU | | --- | --- | --- | --- | | off | 741 / 737 | 0.90 / 0.94 ms | 261% / 238% of a core | | on | 25.6 / 25.8 | 40.6 / 40.5 ms | 61% / 63% of a core | CPU use falls by about 75%. The cap gives 25.7 FPS rather than 30: the existing frame limiter sleeps longer than asked in an unfocused, App-Napped process (vanilla's limiter does the same thing there). World and village load times were within run-to-run noise (25–42 s vs 33–36 s; the load average swung from 21 to 64). Not measured here: the 60 FPS in-focus cap (needs an unlocked screen; `battery_mode_only_lowers_the_frame_cap` covers the rule) and wall power (needs an idle machine or a laptop). ## Self-check ``` cargo fmt --all -- --check ok cargo clippy --workspace --all-targets -- -D warnings ok cargo test -p horizon-client 578 passed (fixed: the row's description was over one line) python3 tools/parity.py options frame_limiter 2 passed python3 tools/parity.py section_mesh light 2 passed (Mac mini) ``` ## Needs Ludovic Nothing to decide. A laptop run (MacBook when it's awake, the ThinkPad) would give a battery-drain figure. 🤖 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:56: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#2441
No description provided.