[PR #3470] [MERGED] perf_bench: run on Windows (and pass vanilla the manifest's -XX flags) #5003

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3470
Author: @d3grando
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: bench-windows


📝 Commits (2)

  • f44af70 perf_bench: run on Windows
  • cc243fa perf_bench: pass vanilla the manifest's -XX flags

📊 Changes

3 files changed (+250 additions, -26 deletions)

View changed files

📝 docs/benchmark.md (+5 -3)
📝 tests/test_perf_bench.py (+103 -0)
📝 tools/perf_bench.py (+142 -23)

📄 Description

🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando themselves.

What and why

tools/perf_bench.py (docs/benchmark.md) didn't run on Windows. Each of these stopped it there, before or right after the first game:

On Windows Was Now
Control socket socket.AF_UNIX at /tmp/…sock. Python has no AF_UNIX on Windows (AttributeError), and the game uses its TCP transport there anyway (control.rs: a localhost port and a token written to a .json endpoint file, first line auth TOKEN) control_path() picks .json in the temp folder when there are no Unix sockets, and Control speaks the TCP transport for a .json endpoint (as horizon-ctl does). Unix keeps /tmp/…sock
Memory sampling ps -o rss=: there's no ps, so the Sampler thread died at the first sample rss_bytes(): ps on macOS/Linux as before, the working set (GetProcessMemoryInfo, what Task Manager shows) on Windows
Load average os.getloadavg() raised AttributeError before the first game load_average() returns None there, and the report leaves load_avg_1m out, as horizon_bench::hardware::load_average does
hardware() read /etc/os-release and /proc/cpuinfo (FileNotFoundError while writing the report) Windows branch: ver (same string as horizon-bench), the CPU brand string from the registry, total RAM from GlobalMemoryStatusEx
nvidia-smi per-process memory is [N/A] under WDDM, so float() raised ValueError in the vanilla run that case gives None; Horizon's figure then falls back to its own allocator total, as on a Mac
Binary target/release/horizon-client horizon-client.exe on Windows
Vanilla JVM flags only the manifest's OS-conditional JVM arguments were passed. Its unconditional -XX:StackShadowPages=32, which the official launcher passes, was dropped, and about half of the vanilla starts crashed before the title screen: EXCEPTION_ACCESS_VIOLATION under shaderc.dll while the client compiles its shaders, with no hs_err file and only the driver's init event (vanilla run failed: [{'event': 'init', …}]) manifest_jvm_flags() adds the manifest's unconditional -XX: flags. On this machine, 8 starts each through run_vanilla: 4 crashed without the flag, none with it (and none in the 27 vanilla games of the results PR)

There's also one change that isn't Windows-only. With --build pointing at an installed release, the report used to name this checkout's 0.1.0 and commit, not the binary that ran. It now takes the version from the game's first log line when that line is a release's or nightly's version (Horizon v0.2.97). A dev build still reports the Cargo version and commit.

Nothing changes on Linux or macOS except that: same commands, same socket path, same ps reading. docs/benchmark.md now says what Windows reads instead of ps and the load average, and how to point --build at an installed release.

Tests (tests/test_perf_bench.py, PortabilityTests): the TCP transport against a stand-in endpoint (auth, reply, refused token), rss_bytes of the test process, load_average, a report without a load average, nvidia-smi's [N/A], the release version read from the log, and the manifest's JVM flags. They run the same on Linux CI.

Two commits: the Windows fixes, then the manifest JVM flag (that one affects every OS, since the flag is the official launcher's, but it only showed up as crashes on Windows).

Verified on Windows 11 (Ryzen 7 9800X3D, RTX 5080), Python 3.12, with Horizon v0.2.97 as installed by the launcher and the vanilla 26.3 client + Fabric driver mod:

  • before (origin/main, 142388e1c): every --game stops at AttributeError: module 'os' has no attribute 'getloadavg' before starting a game. Calling the pieces one by one: Control(...)("status") → AttributeError: module 'socket' has no attribute 'AF_UNIX'; Sampler → the thread dies at its first sample with no samples (FileNotFoundError without ps; Git for Windows' ps on PATH has no -o and kills it as well); hardware() → FileNotFoundError: '\\etc\\os-release'; nvidia-smi --query-compute-apps=pid,used_memory prints 12140, [N/A] for every process.
  • after: python tools/perf_bench.py --game horizon --build %APPDATA%\horizon-launcher\versions\v0.2.97 --resources …\.local\horizon-client\26.3 and --game vanilla both run all four scenes and write their reports; full results are in the follow-up PR (benchmarks/perf).
  • python -m unittest tests.test_perf_bench → 15 tests OK. python -m unittest discover -s tests → the only failures are in test_port_publish (2) and test_roadmap (1). Those modules don't touch perf_bench: they compare text read with Windows' default cp1251 encoding (ROADMAP.md is out of date, mojibake in the diff).

Vanilla reference

none (tooling and docs)

Self-check

tools/pr_ready.py doesn't start on Windows until the signal.SIGHUP fix for pr_ready.py/parity.py lands (separate PR), so it wasn't run here. What it would check for this change: Python tests (above); no Rust, launcher or content changes. Scope: 3 files (tools/perf_bench.py, tests/test_perf_bench.py, docs/benchmark.md), about +250 −25. Label: skip-release (players see no change).

It touches build_bench_mod's neighbourhood but not the javac line, so it doesn't conflict with #3337.

🤖 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/3470 **Author:** [@d3grando](https://github.com/d3grando) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `bench-windows` --- ### 📝 Commits (2) - [`f44af70`](https://github.com/horizon-rust/horizon/commit/f44af70080d5459a23b433dd3152d6bbce8391e6) perf_bench: run on Windows - [`cc243fa`](https://github.com/horizon-rust/horizon/commit/cc243fabd805be5964c5f31dc9e87227a54cfab6) perf_bench: pass vanilla the manifest's -XX flags ### 📊 Changes **3 files changed** (+250 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `docs/benchmark.md` (+5 -3) 📝 `tests/test_perf_bench.py` (+103 -0) 📝 `tools/perf_bench.py` (+142 -23) </details> ### 📄 Description > 🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando themselves. ## What and why `tools/perf_bench.py` (docs/benchmark.md) didn't run on Windows. Each of these stopped it there, before or right after the first game: | On Windows | Was | Now | |---|---|---| | Control socket | `socket.AF_UNIX` at `/tmp/…sock`. Python has no `AF_UNIX` on Windows (`AttributeError`), and the game uses its TCP transport there anyway (`control.rs`: a localhost port and a token written to a `.json` endpoint file, first line `auth TOKEN`) | `control_path()` picks `.json` in the temp folder when there are no Unix sockets, and `Control` speaks the TCP transport for a `.json` endpoint (as `horizon-ctl` does). Unix keeps `/tmp/…sock` | | Memory sampling | `ps -o rss=`: there's no `ps`, so the `Sampler` thread died at the first sample | `rss_bytes()`: `ps` on macOS/Linux as before, the working set (`GetProcessMemoryInfo`, what Task Manager shows) on Windows | | Load average | `os.getloadavg()` raised `AttributeError` before the first game | `load_average()` returns `None` there, and the report leaves `load_avg_1m` out, as `horizon_bench::hardware::load_average` does | | `hardware()` | read `/etc/os-release` and `/proc/cpuinfo` (`FileNotFoundError` while writing the report) | Windows branch: `ver` (same string as horizon-bench), the CPU brand string from the registry, total RAM from `GlobalMemoryStatusEx` | | `nvidia-smi` | per-process memory is `[N/A]` under WDDM, so `float()` raised `ValueError` in the vanilla run | that case gives `None`; Horizon's figure then falls back to its own allocator total, as on a Mac | | Binary | `target/release/horizon-client` | `horizon-client.exe` on Windows | | Vanilla JVM flags | only the manifest's OS-conditional JVM arguments were passed. Its unconditional `-XX:StackShadowPages=32`, which the official launcher passes, was dropped, and about half of the vanilla starts crashed before the title screen: `EXCEPTION_ACCESS_VIOLATION` under `shaderc.dll` while the client compiles its shaders, with no hs_err file and only the driver's `init` event (`vanilla run failed: [{'event': 'init', …}]`) | `manifest_jvm_flags()` adds the manifest's unconditional `-XX:` flags. On this machine, 8 starts each through `run_vanilla`: 4 crashed without the flag, none with it (and none in the 27 vanilla games of the results PR) | There's also one change that isn't Windows-only. With `--build` pointing at an installed release, the report used to name this checkout's `0.1.0` and commit, not the binary that ran. It now takes the version from the game's first log line when that line is a release's or nightly's version (`Horizon v0.2.97`). A dev build still reports the Cargo version and commit. Nothing changes on Linux or macOS except that: same commands, same socket path, same `ps` reading. docs/benchmark.md now says what Windows reads instead of `ps` and the load average, and how to point `--build` at an installed release. Tests (`tests/test_perf_bench.py`, `PortabilityTests`): the TCP transport against a stand-in endpoint (auth, reply, refused token), `rss_bytes` of the test process, `load_average`, a report without a load average, `nvidia-smi`'s `[N/A]`, the release version read from the log, and the manifest's JVM flags. They run the same on Linux CI. Two commits: the Windows fixes, then the manifest JVM flag (that one affects every OS, since the flag is the official launcher's, but it only showed up as crashes on Windows). Verified on Windows 11 (Ryzen 7 9800X3D, RTX 5080), Python 3.12, with Horizon v0.2.97 as installed by the launcher and the vanilla 26.3 client + Fabric driver mod: - before (`origin/main`, 142388e1c): every `--game` stops at `AttributeError: module 'os' has no attribute 'getloadavg'` before starting a game. Calling the pieces one by one: `Control(...)("status")` → `AttributeError: module 'socket' has no attribute 'AF_UNIX'`; `Sampler` → the thread dies at its first sample with no samples (`FileNotFoundError` without `ps`; Git for Windows' `ps` on `PATH` has no `-o` and kills it as well); `hardware()` → `FileNotFoundError: '\\etc\\os-release'`; `nvidia-smi --query-compute-apps=pid,used_memory` prints `12140, [N/A]` for every process. - after: `python tools/perf_bench.py --game horizon --build %APPDATA%\horizon-launcher\versions\v0.2.97 --resources …\.local\horizon-client\26.3` and `--game vanilla` both run all four scenes and write their reports; full results are in the follow-up PR (benchmarks/perf). - `python -m unittest tests.test_perf_bench` → 15 tests OK. `python -m unittest discover -s tests` → the only failures are in `test_port_publish` (2) and `test_roadmap` (1). Those modules don't touch perf_bench: they compare text read with Windows' default cp1251 encoding (`ROADMAP.md is out of date`, mojibake in the diff). ## Vanilla reference none (tooling and docs) ## Self-check `tools/pr_ready.py` doesn't start on Windows until the `signal.SIGHUP` fix for `pr_ready.py`/`parity.py` lands (separate PR), so it wasn't run here. What it would check for this change: Python tests (above); no Rust, launcher or content changes. Scope: 3 files (`tools/perf_bench.py`, `tests/test_perf_bench.py`, `docs/benchmark.md`), about +250 −25. Label: `skip-release` (players see no change). It touches `build_bench_mod`'s neighbourhood but not the `javac` line, so it doesn't conflict with #3337. 🤖 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 05:09:31 +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#5003
No description provided.