[PR #3] [MERGED] Respect short-job terrain worker budgets with precise pacing #2253

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

📋 Pull Request Information

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

Base: main ← Head: precise-terrain-pacing


📝 Commits (4)

  • 4052f20 Add optional precise distant terrain worker pacing
  • 7b3840e Credit coarse timer overshoot while bounding stall recovery
  • b718bef Lengthen worker measurements to reduce CPU counter quantization
  • 2014c2e Document real worker measurements and game integration evidence

📊 Changes

19 files changed (+441 additions, -6 deletions)

View changed files

📝 .github/workflows/ci.yml (+3 -0)
📝 README.md (+8 -2)
➕ benchmarks/worker-pacing-2026-10-03/macos-26.txt (+14 -0)
➕ benchmarks/worker-pacing-2026-10-03/ubuntu-latest.txt (+14 -0)
➕ benchmarks/worker-pacing-2026-10-03/windows-latest.txt (+14 -0)
📝 docs/playable-validation.md (+10 -0)
➕ docs/worker-pacing.md (+93 -0)
➕ mods/horizon-lab/src/main/java/dev/horizonlab/budget/WorkerPacer.java (+36 -0)
📝 mods/horizon-lab/src/main/java/dev/horizonlab/client/HorizonClient.java (+1 -0)
➕ mods/horizon-lab/src/main/java/dev/horizonlab/mixin/DhWorkerPacingMixin.java (+42 -0)
➕ mods/horizon-lab/src/main/java/dev/horizonlab/mixin/HorizonMixinPlugin.java (+45 -0)
📝 mods/horizon-lab/src/main/resources/fabric.mod.json (+1 -1)
📝 mods/horizon-lab/src/main/resources/horizonlab.mixins.json (+2 -1)
➕ mods/horizon-lab/src/test/java/dev/horizonlab/budget/WorkerPacerTest.java (+48 -0)
➕ mods/horizon-lab/src/test/java/dev/horizonlab/budget/WorkerPacingBenchmark.java (+64 -0)
📝 packs/START-HERE.txt (+8 -0)
📝 packs/mods.lock.json (+1 -1)
📝 tools/build_mod.py (+31 -0)
📝 tools/build_pack.py (+6 -1)

📄 Description

DH 3.3.4 rounds worker waits down to whole milliseconds. Tiny jobs can reach sleep(0), making background duty cycle depend on JVM/OS scheduling. Add an optional precise hook that accumulates fractional waits, credits timer overshoot and uses primitive timing state. Balanced remains unchanged; separate worker-pacing and adaptive-pacing profiles expose the experiment.

The hook requires opt-in configuration and exact DH 3.3.4. It retains runnable/queue behavior and captures its state in frame reports. Tests cover duty cycles, coarse timers, configuration changes and bounded recovery. A 50,000-job benchmark compares the actual upstream executor across Linux, Apple Silicon macOS and Windows; raw results and their limits are committed.

Validation: all platform checks passed. The final binary rendered a real demo world, updated distant-terrain data and produced matching CSV/JSON with 359 frame intervals and 2,401 integrated-server ticks over 120 seconds. Clean world/database/worker shutdown and baseline startup without DH were checked. Runtime and release JARs match byte-for-byte. Linux uses llvmpipe; isolated worker measurements do not establish game FPS or an M2 Pro graphics improvement.


🔄 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/3 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/3/2026 **Status:** ✅ Merged **Merged:** 10/3/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `precise-terrain-pacing` --- ### 📝 Commits (4) - [`4052f20`](https://github.com/horizon-rust/horizon/commit/4052f2040d484bd261ca19d87893eee6b8662e13) Add optional precise distant terrain worker pacing - [`7b3840e`](https://github.com/horizon-rust/horizon/commit/7b3840ea8f1470eac461eedd4549113ab013bf5f) Credit coarse timer overshoot while bounding stall recovery - [`b718bef`](https://github.com/horizon-rust/horizon/commit/b718bef55592c2e9eb2e8e5b96afa9bb806c329e) Lengthen worker measurements to reduce CPU counter quantization - [`2014c2e`](https://github.com/horizon-rust/horizon/commit/2014c2ec913957742ed6c29517cba510dce58f06) Document real worker measurements and game integration evidence ### 📊 Changes **19 files changed** (+441 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/ci.yml` (+3 -0) 📝 `README.md` (+8 -2) ➕ `benchmarks/worker-pacing-2026-10-03/macos-26.txt` (+14 -0) ➕ `benchmarks/worker-pacing-2026-10-03/ubuntu-latest.txt` (+14 -0) ➕ `benchmarks/worker-pacing-2026-10-03/windows-latest.txt` (+14 -0) 📝 `docs/playable-validation.md` (+10 -0) ➕ `docs/worker-pacing.md` (+93 -0) ➕ `mods/horizon-lab/src/main/java/dev/horizonlab/budget/WorkerPacer.java` (+36 -0) 📝 `mods/horizon-lab/src/main/java/dev/horizonlab/client/HorizonClient.java` (+1 -0) ➕ `mods/horizon-lab/src/main/java/dev/horizonlab/mixin/DhWorkerPacingMixin.java` (+42 -0) ➕ `mods/horizon-lab/src/main/java/dev/horizonlab/mixin/HorizonMixinPlugin.java` (+45 -0) 📝 `mods/horizon-lab/src/main/resources/fabric.mod.json` (+1 -1) 📝 `mods/horizon-lab/src/main/resources/horizonlab.mixins.json` (+2 -1) ➕ `mods/horizon-lab/src/test/java/dev/horizonlab/budget/WorkerPacerTest.java` (+48 -0) ➕ `mods/horizon-lab/src/test/java/dev/horizonlab/budget/WorkerPacingBenchmark.java` (+64 -0) 📝 `packs/START-HERE.txt` (+8 -0) 📝 `packs/mods.lock.json` (+1 -1) 📝 `tools/build_mod.py` (+31 -0) 📝 `tools/build_pack.py` (+6 -1) </details> ### 📄 Description DH 3.3.4 rounds worker waits down to whole milliseconds. Tiny jobs can reach sleep(0), making background duty cycle depend on JVM/OS scheduling. Add an optional precise hook that accumulates fractional waits, credits timer overshoot and uses primitive timing state. Balanced remains unchanged; separate worker-pacing and adaptive-pacing profiles expose the experiment. The hook requires opt-in configuration and exact DH 3.3.4. It retains runnable/queue behavior and captures its state in frame reports. Tests cover duty cycles, coarse timers, configuration changes and bounded recovery. A 50,000-job benchmark compares the actual upstream executor across Linux, Apple Silicon macOS and Windows; raw results and their limits are committed. Validation: all platform checks passed. The final binary rendered a real demo world, updated distant-terrain data and produced matching CSV/JSON with 359 frame intervals and 2,401 integrated-server ticks over 120 seconds. Clean world/database/worker shutdown and baseline startup without DH were checked. Runtime and release JARs match byte-for-byte. Linux uses llvmpipe; isolated worker measurements do not establish game FPS or an M2 Pro graphics improvement. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:54:24 +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#2253
No description provided.