[PR #15] [MERGED] Reduce empty culling allocations and release interrupted DH reads #2265

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

📋 Pull Request Information

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

Base: main ← Head: culling-empty-whitelists


📝 Commits (4)

  • 35dd69e Avoid empty culling whitelist iterator allocation while keeping live registration
  • 1f97a8e Record actual world difficulty and preserve sanitized culling fixture evidence
  • 9a1b22a Release interrupted DH metadata reads without cancelling shared futures
  • 45f0fd3 Document applied read cancellation evidence and final world recording

📊 Changes

25 files changed (+809 additions, -12 deletions)

View changed files

📝 .github/workflows/ci.yml (+12 -0)
📝 README.md (+9 -1)
➕ benchmarks/culling-empty-2026-10-04/linux-applied-hooks.json (+47 -0)
➕ benchmarks/terrain-read-2026-10-04/linux-applied-hooks.json (+43 -0)
➕ benchmarks/terrain-read-2026-10-04/local-applied-hooks.json (+41 -0)
➕ docs/culling-empty.md (+58 -0)
➕ docs/terrain-read-wait.md (+50 -0)
➕ mods/horizon-lab/src/main/java/dev/horizonlab/budget/TerrainReadWait.java (+27 -0)
📝 mods/horizon-lab/src/main/java/dev/horizonlab/client/HorizonClient.java (+3 -0)
➕ mods/horizon-lab/src/main/java/dev/horizonlab/mixin/CullingEmptyWhitelistMixin.java (+19 -0)
➕ mods/horizon-lab/src/main/java/dev/horizonlab/mixin/DhTerrainReadWaitMixin.java (+18 -0)
📝 mods/horizon-lab/src/main/java/dev/horizonlab/mixin/HorizonMixinPlugin.java (+39 -0)
📝 mods/horizon-lab/src/main/resources/fabric.mod.json (+1 -1)
📝 mods/horizon-lab/src/main/resources/horizonlab.mixins.json (+1 -1)
➕ mods/horizon-lab/src/test/java/dev/horizonlab/dispatch/CullingEmptyIntegration.java (+100 -0)
➕ mods/horizon-lab/src/test/java/dev/horizonlab/dispatch/TerrainReadIntegration.java (+155 -0)
📝 packs/START-HERE.txt (+10 -0)
📝 packs/mods.lock.json (+1 -1)
📝 tests/test_packs.py (+21 -2)
📝 tools/Compare-Benchmarks.html (+5 -2)

...and 5 more files

📄 Description

Empty dynamic culling whitelists repeatedly allocated iterators. The optional pinned shortcut uses a shared empty iterator only while the live set is empty; nonempty registration, callback order, short circuit and type guards stay upstream. Adds an isolated culling-empty profile and records its actual applied state.

A world smoke check also exposed an intermittent client-exit wait: a non-daemon DH generation worker remained in a cached blending-metadata future after the world saved. The scoped shutdown fix makes only pending metadata reads on pinned DH generation workers interruptible. It preserves ordinary callers, completed results, join exception/cancellation reporting and the interrupt flag, and never cancels the shared future. DH profiles request it; profiles without DH do not. The frame report and viewer disclose its applied state. World difficulty is now captured so mismatches can be detected.

Validation: 26 offline Python checks pass. Applied Fabric culling fixtures check live registration, duplicate handling, real block-entity callback order/short circuit, null/wrong types and clearing. Read fixtures exercise the real transformed IOWorker, forcing pending interruption and checking a later shared-future consumer, ordinary/other-DH callers, pre-existing interrupts, exceptional completion identity and cancelled completion reporting. Full game artifacts and fixture JARs remain private.

A warmed empty-whitelist loop allocated 128,001,248 bytes upstream versus 1,248 with the shortcut. Single CPU observations were 41 ms versus 33 ms; JIT folding varies by caller. A fixed-order 120-second software-rendered world pair had matching captured graphics, zero excluded frames, and 562/553 frame intervals with 2,411 ticks each. Diagnostic CullThread counters observed about 97,445/35,128 allocated bytes per second over separate 64-second spans. These are mechanism observations, not repeatable game FPS, whole-game RAM or Mac GPU gains. Valid-world-entity callbacks are not exercised by the menu-only culling fixture. Linux, Windows and hosted Apple Silicon macOS 26 CI passed (run 37166150119). The final JAR matches the Linux CI artifact byte-for-byte. It recorded 579 frames and 2,408 ticks over 120 seconds with zero excluded frames and matching CSV summaries, retained unchanged captured visual settings, saved, and reloaded the world in the same client. Thread snapshots found no generation workers or blocked background futures after the first save, and two working generation threads after reload. A fresh traced world run saved and closed its databases, then the game/launcher/vscreen process chain each exited with status 0 and no SIGTERM in that traced tree. The outer execution harness reported 143; this is kept separate from the verified game process exit. The offline viewer passes actual CSV/metadata, difficulty mismatch, experiment warning and 390px layout checks. Prepares v0.14.0.


🔄 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/15 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/4/2026 **Status:** ✅ Merged **Merged:** 10/4/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `culling-empty-whitelists` --- ### 📝 Commits (4) - [`35dd69e`](https://github.com/horizon-rust/horizon/commit/35dd69e9a6279fa89d762a0d24e49b0dbdb11b51) Avoid empty culling whitelist iterator allocation while keeping live registration - [`1f97a8e`](https://github.com/horizon-rust/horizon/commit/1f97a8e48795be99c7239b21156730ce49931f99) Record actual world difficulty and preserve sanitized culling fixture evidence - [`9a1b22a`](https://github.com/horizon-rust/horizon/commit/9a1b22aa56f58a3ee39a3564be859a662d2beedc) Release interrupted DH metadata reads without cancelling shared futures - [`45f0fd3`](https://github.com/horizon-rust/horizon/commit/45f0fd39b60e1700d9910bdee8354b8d0ecc4208) Document applied read cancellation evidence and final world recording ### 📊 Changes **25 files changed** (+809 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/ci.yml` (+12 -0) 📝 `README.md` (+9 -1) ➕ `benchmarks/culling-empty-2026-10-04/linux-applied-hooks.json` (+47 -0) ➕ `benchmarks/terrain-read-2026-10-04/linux-applied-hooks.json` (+43 -0) ➕ `benchmarks/terrain-read-2026-10-04/local-applied-hooks.json` (+41 -0) ➕ `docs/culling-empty.md` (+58 -0) ➕ `docs/terrain-read-wait.md` (+50 -0) ➕ `mods/horizon-lab/src/main/java/dev/horizonlab/budget/TerrainReadWait.java` (+27 -0) 📝 `mods/horizon-lab/src/main/java/dev/horizonlab/client/HorizonClient.java` (+3 -0) ➕ `mods/horizon-lab/src/main/java/dev/horizonlab/mixin/CullingEmptyWhitelistMixin.java` (+19 -0) ➕ `mods/horizon-lab/src/main/java/dev/horizonlab/mixin/DhTerrainReadWaitMixin.java` (+18 -0) 📝 `mods/horizon-lab/src/main/java/dev/horizonlab/mixin/HorizonMixinPlugin.java` (+39 -0) 📝 `mods/horizon-lab/src/main/resources/fabric.mod.json` (+1 -1) 📝 `mods/horizon-lab/src/main/resources/horizonlab.mixins.json` (+1 -1) ➕ `mods/horizon-lab/src/test/java/dev/horizonlab/dispatch/CullingEmptyIntegration.java` (+100 -0) ➕ `mods/horizon-lab/src/test/java/dev/horizonlab/dispatch/TerrainReadIntegration.java` (+155 -0) 📝 `packs/START-HERE.txt` (+10 -0) 📝 `packs/mods.lock.json` (+1 -1) 📝 `tests/test_packs.py` (+21 -2) 📝 `tools/Compare-Benchmarks.html` (+5 -2) _...and 5 more files_ </details> ### 📄 Description Empty dynamic culling whitelists repeatedly allocated iterators. The optional pinned shortcut uses a shared empty iterator only while the live set is empty; nonempty registration, callback order, short circuit and type guards stay upstream. Adds an isolated culling-empty profile and records its actual applied state. A world smoke check also exposed an intermittent client-exit wait: a non-daemon DH generation worker remained in a cached blending-metadata future after the world saved. The scoped shutdown fix makes only pending metadata reads on pinned DH generation workers interruptible. It preserves ordinary callers, completed results, join exception/cancellation reporting and the interrupt flag, and never cancels the shared future. DH profiles request it; profiles without DH do not. The frame report and viewer disclose its applied state. World difficulty is now captured so mismatches can be detected. Validation: 26 offline Python checks pass. Applied Fabric culling fixtures check live registration, duplicate handling, real block-entity callback order/short circuit, null/wrong types and clearing. Read fixtures exercise the real transformed IOWorker, forcing pending interruption and checking a later shared-future consumer, ordinary/other-DH callers, pre-existing interrupts, exceptional completion identity and cancelled completion reporting. Full game artifacts and fixture JARs remain private. A warmed empty-whitelist loop allocated 128,001,248 bytes upstream versus 1,248 with the shortcut. Single CPU observations were 41 ms versus 33 ms; JIT folding varies by caller. A fixed-order 120-second software-rendered world pair had matching captured graphics, zero excluded frames, and 562/553 frame intervals with 2,411 ticks each. Diagnostic CullThread counters observed about 97,445/35,128 allocated bytes per second over separate 64-second spans. These are mechanism observations, not repeatable game FPS, whole-game RAM or Mac GPU gains. Valid-world-entity callbacks are not exercised by the menu-only culling fixture. Linux, Windows and hosted Apple Silicon macOS 26 CI passed (run 37166150119). The final JAR matches the Linux CI artifact byte-for-byte. It recorded 579 frames and 2,408 ticks over 120 seconds with zero excluded frames and matching CSV summaries, retained unchanged captured visual settings, saved, and reloaded the world in the same client. Thread snapshots found no generation workers or blocked background futures after the first save, and two working generation threads after reload. A fresh traced world run saved and closed its databases, then the game/launcher/vscreen process chain each exited with status 0 and no SIGTERM in that traced tree. The outer execution harness reported 143; this is kept separate from the verified game process exit. The offline viewer passes actual CSV/metadata, difficulty mismatch, experiment warning and 390px layout checks. Prepares v0.14.0. --- <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:29 +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#2265
No description provided.