[PR #19] [MERGED] Reuse discarded terrain quads without replacing geometry or existing pools #2269

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

📋 Pull Request Information

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

Base: main ← Head: terrain-quad-reuse


📝 Commits (2)

  • 0a0cd66 Reuse discarded terrain quads at fresh allocation sites with isolated controls
  • 4346969 Record quad reuse geometry checks and qualified live comparison

📊 Changes

20 files changed (+722 additions, -7 deletions)

View changed files

📝 .github/workflows/ci.yml (+6 -0)
📝 README.md (+8 -1)
➕ benchmarks/quad-reuse-2026-10-04/exploratory-observations.json (+67 -0)
➕ benchmarks/quad-reuse-2026-10-04/linux-applied-hooks.json (+75 -0)
➕ benchmarks/quad-reuse-2026-10-04/live-observations.json (+166 -0)
➕ benchmarks/quad-reuse-2026-10-04/local-applied-hooks.json (+75 -0)
➕ docs/quad-reuse.md (+68 -0)
📝 mods/horizon-lab/src/main/java/dev/horizonlab/client/HorizonClient.java (+1 -0)
➕ mods/horizon-lab/src/main/java/dev/horizonlab/mixin/DhQuadReuseMixin.java (+31 -0)
📝 mods/horizon-lab/src/main/java/dev/horizonlab/mixin/HorizonMixinPlugin.java (+18 -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/dispatch/QuadReuseIntegration.java (+99 -0)
📝 packs/START-HERE.txt (+6 -0)
📝 packs/mods.lock.json (+1 -1)
📝 tests/test_packs.py (+19 -0)
📝 tools/Compare-Benchmarks.html (+2 -1)
📝 tools/build_pack.py (+4 -1)
📝 tools/compare_benchmarks.py (+1 -1)
➕ tools/test_quad_reuse.py (+72 -0)

📄 Description

Distant Horizons 3.3.4 allocates a temporary quad before adjacent-face premerge, then discards it after a successful merge. In a generated merging-heavy workload, the original builder repeatedly allocates those objects even though their geometry never reaches the retained face lists.

Add an isolated quad-reuse profile that retains at most one successfully discarded quad per builder and supplies it only where the existing pool would otherwise allocate a fresh object. Existing pool selection, merge predicates, geometry lists, sorting, lighting/materials, rendering budgets and vanilla simulation stay upstream. The hook is limited to the inspected DH version and remains off in other profiles, including combined profiles. Client reports and both comparison tools capture its actual applied flag.

Validation: 34 offline Python checks and original mod/publisher adapter compilation pass locally. The applied Fabric fixture matches all stored geometry fields before and after merging across 55,296 generated faces, opaque/translucent lists, sort keys, pooled error flags and four concurrent builders. Its current caller-loop allocation observations are 144,576,000 bytes upstream versus 2,016,000 bytes with reuse over 3,072,000 faces. CPU observations vary with warm-up and do not establish game FPS, retained RAM or Mac performance. Startup without DH reaches the menu and exits with code 0. Windows/macOS ARM/Linux CI passes on source 0a0cd667d5. The independent Linux JAR matches the local binary byte-for-byte. Independent allocation totals match, while CI caller CPU was slightly slower with reuse (about 40.4/44.1 ms).

A stationary matched-settings live pair recorded 220 control/224 candidate frames and 2,400/2,401 ticks over approximately 120 seconds, with zero exclusions and dropped samples. First saved cameras match. Both save and exit with code zero; candidate reload and second save also pass. Sampled peak RSS differs by less than one percent, while preceding render-loader allocation counter rates are higher with reuse. Task volumes and cache/JIT effects are not quantitatively controlled. No useful live allocation, FPS or memory gain is established. These Linux software-rendered observations are not Apple Silicon results. Selected measurements and provenance are checked in; private worlds/logs/JFR recordings are excluded. Actual JSON/CSV viewer and 390-pixel layout checks pass.


🔄 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/19 **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:** `terrain-quad-reuse` --- ### 📝 Commits (2) - [`0a0cd66`](https://github.com/horizon-rust/horizon/commit/0a0cd667d5cfdee7c59f5fe2c7a2eb15bd19e66e) Reuse discarded terrain quads at fresh allocation sites with isolated controls - [`4346969`](https://github.com/horizon-rust/horizon/commit/43469691a4bc499f21e4f6f4257cc26c74fcb6b1) Record quad reuse geometry checks and qualified live comparison ### 📊 Changes **20 files changed** (+722 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/ci.yml` (+6 -0) 📝 `README.md` (+8 -1) ➕ `benchmarks/quad-reuse-2026-10-04/exploratory-observations.json` (+67 -0) ➕ `benchmarks/quad-reuse-2026-10-04/linux-applied-hooks.json` (+75 -0) ➕ `benchmarks/quad-reuse-2026-10-04/live-observations.json` (+166 -0) ➕ `benchmarks/quad-reuse-2026-10-04/local-applied-hooks.json` (+75 -0) ➕ `docs/quad-reuse.md` (+68 -0) 📝 `mods/horizon-lab/src/main/java/dev/horizonlab/client/HorizonClient.java` (+1 -0) ➕ `mods/horizon-lab/src/main/java/dev/horizonlab/mixin/DhQuadReuseMixin.java` (+31 -0) 📝 `mods/horizon-lab/src/main/java/dev/horizonlab/mixin/HorizonMixinPlugin.java` (+18 -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/dispatch/QuadReuseIntegration.java` (+99 -0) 📝 `packs/START-HERE.txt` (+6 -0) 📝 `packs/mods.lock.json` (+1 -1) 📝 `tests/test_packs.py` (+19 -0) 📝 `tools/Compare-Benchmarks.html` (+2 -1) 📝 `tools/build_pack.py` (+4 -1) 📝 `tools/compare_benchmarks.py` (+1 -1) ➕ `tools/test_quad_reuse.py` (+72 -0) </details> ### 📄 Description Distant Horizons 3.3.4 allocates a temporary quad before adjacent-face premerge, then discards it after a successful merge. In a generated merging-heavy workload, the original builder repeatedly allocates those objects even though their geometry never reaches the retained face lists. Add an isolated `quad-reuse` profile that retains at most one successfully discarded quad per builder and supplies it only where the existing pool would otherwise allocate a fresh object. Existing pool selection, merge predicates, geometry lists, sorting, lighting/materials, rendering budgets and vanilla simulation stay upstream. The hook is limited to the inspected DH version and remains off in other profiles, including combined profiles. Client reports and both comparison tools capture its actual applied flag. Validation: 34 offline Python checks and original mod/publisher adapter compilation pass locally. The applied Fabric fixture matches all stored geometry fields before and after merging across 55,296 generated faces, opaque/translucent lists, sort keys, pooled error flags and four concurrent builders. Its current caller-loop allocation observations are 144,576,000 bytes upstream versus 2,016,000 bytes with reuse over 3,072,000 faces. CPU observations vary with warm-up and do not establish game FPS, retained RAM or Mac performance. Startup without DH reaches the menu and exits with code 0. Windows/macOS ARM/Linux CI passes on source 0a0cd667d5cfdee7c59f5fe2c7a2eb15bd19e66e. The independent Linux JAR matches the local binary byte-for-byte. Independent allocation totals match, while CI caller CPU was slightly slower with reuse (about 40.4/44.1 ms). A stationary matched-settings live pair recorded 220 control/224 candidate frames and 2,400/2,401 ticks over approximately 120 seconds, with zero exclusions and dropped samples. First saved cameras match. Both save and exit with code zero; candidate reload and second save also pass. Sampled peak RSS differs by less than one percent, while preceding render-loader allocation counter rates are higher with reuse. Task volumes and cache/JIT effects are not quantitatively controlled. No useful live allocation, FPS or memory gain is established. These Linux software-rendered observations are not Apple Silicon results. Selected measurements and provenance are checked in; private worlds/logs/JFR recordings are excluded. Actual JSON/CSV viewer and 390-pixel layout checks pass. --- <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:30 +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#2269
No description provided.