[PR #17] [MERGED] Test equivalent arithmetic in the terrain data lookup #2268

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/17
Author: @ludovic111
Created: 10/4/2026
Status: ✅ Merged
Merged: 10/4/2026
Merged by: @ludovic111

Base: main ← Head: terrain-position-arithmetic


📝 Commits (2)

  • c6ec0b5 Test equivalent arithmetic in the sampled terrain data lookup
  • f692f04 Record independent lookup results and matched live validation

📊 Changes

23 files changed (+1028 additions, -7 deletions)

View changed files

📝 .github/workflows/ci.yml (+6 -0)
📝 README.md (+7 -1)
➕ benchmarks/terrain-position-2026-10-04/exploratory-observations.json (+274 -0)
➕ benchmarks/terrain-position-2026-10-04/linux-applied-hooks.json (+88 -0)
➕ benchmarks/terrain-position-2026-10-04/live-observations.json (+126 -0)
➕ benchmarks/terrain-position-2026-10-04/local-applied-hooks.json (+98 -0)
➕ docs/terrain-position.md (+80 -0)
📝 mods/horizon-lab/src/main/java/dev/horizonlab/client/HorizonClient.java (+1 -0)
➕ mods/horizon-lab/src/main/java/dev/horizonlab/geometry/RelativeTerrainPosition.java (+30 -0)
➕ mods/horizon-lab/src/main/java/dev/horizonlab/mixin/DhRelativePositionMixin.java (+16 -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/PositionIntegration.java (+121 -0)
➕ mods/horizon-lab/src/test/java/dev/horizonlab/geometry/RelativeTerrainPositionTest.java (+52 -0)
📝 packs/START-HERE.txt (+4 -0)
📝 packs/mods.lock.json (+1 -1)
📝 tests/test_packs.py (+21 -0)
📝 tools/Compare-Benchmarks.html (+2 -1)
📝 tools/build_mod.py (+3 -0)

...and 3 more files

📄 Description

A live client profile sampled relative section-position conversion in Distant Horizons’ full-data lookup. This change redirects only that call to equivalent primitive Java arithmetic, avoiding variable division on the eligible path without a cache, native call or retained per-source fields. Original containment, column selection, datapoint search and source contents remain upstream. The pinned library’s unusual negative-coordinate rounding is retained; invalid levels and sign-bit divisors delegate to its original method.

Adds an isolated terrain-position pack, disables it in every other profile, captures the actual applied flag, and discloses flag changes in both comparison tools. The hook requires DH 3.3.4. Publisher classes and private fixtures are never bundled.

Validation: 30 offline checks pass. An actual publisher differential suite passes 1,525,313 cases, including 1,124,986 invalid-level exceptions, signed-coordinate/power boundaries, selected input levels/all output bytes, integer extrema, reserved bits and one million random positions. The applied Fabric off/on fixture matches 491,520 public lookups across 30 generated owners/six detail levels, with 327,049 populated-column results, unchanged data fingerprints and a verified redirect method in each mode.

Performance observations are mixed and warm-up sensitive. The first two-million-lookup observation was 120/225 ms caller CPU. Later six-million sets were 250/261 ms and, after longer warm-up/compilation waits, 331/260 ms. These are fixed-order single forks with three sequential warmed observations, not independent repetitions, statistical speedup estimates, whole-game FPS/RAM or Mac GPU measurements. Numeric-cache and plain-shift candidates were discarded for cost or equivalence failures. The hook remains off in recommended profiles. Windows x64, macOS ARM and Linux x64 checks passed at c6ec0b5 (workflow 37171062262). The independent Linux JAR matches the local binary byte-for-byte; its three two-million-lookup caller CPU observations were 59.7/52.7/52.5 ms upstream versus 56.1/47.9/47.7 ms with the hook. These favor the hook in that fixture, without establishing whole-game or cross-hardware gains. Raw current, independent CI and earlier exploratory observations retain source/protocol limits. The exact JAR reaches the baseline menu without DH and exits 0. Its landscape-world candidate captured 219 frames over 120 seconds with zero exclusions, matching CSV count and unchanged captured visual settings. World save, reload and second save succeeded; the candidate process exited 0 without a crash report or remaining game process. The matching control capture and final viewer pair checks are in progress. Prepares v0.16.0.

Final live pair: 221 control / 219 candidate frames and 2,401 ticks each, zero frame exclusions or dropped samples, matched captured settings and first saved cameras. No FPS gain is established. Candidate save/reload/second save and control save passed; both foreground clients exited with code 0. Actual JSON/CSV comparison and mobile viewer checks pass. Sanitized raw results retain warm-up, fixed-order and software-rendering limits.


🔄 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/17 **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-position-arithmetic` --- ### 📝 Commits (2) - [`c6ec0b5`](https://github.com/horizon-rust/horizon/commit/c6ec0b5e14d2ea3546fb8858be4a655634a93387) Test equivalent arithmetic in the sampled terrain data lookup - [`f692f04`](https://github.com/horizon-rust/horizon/commit/f692f04d0204a7b7bf720acb5703b3300f6d9234) Record independent lookup results and matched live validation ### 📊 Changes **23 files changed** (+1028 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/ci.yml` (+6 -0) 📝 `README.md` (+7 -1) ➕ `benchmarks/terrain-position-2026-10-04/exploratory-observations.json` (+274 -0) ➕ `benchmarks/terrain-position-2026-10-04/linux-applied-hooks.json` (+88 -0) ➕ `benchmarks/terrain-position-2026-10-04/live-observations.json` (+126 -0) ➕ `benchmarks/terrain-position-2026-10-04/local-applied-hooks.json` (+98 -0) ➕ `docs/terrain-position.md` (+80 -0) 📝 `mods/horizon-lab/src/main/java/dev/horizonlab/client/HorizonClient.java` (+1 -0) ➕ `mods/horizon-lab/src/main/java/dev/horizonlab/geometry/RelativeTerrainPosition.java` (+30 -0) ➕ `mods/horizon-lab/src/main/java/dev/horizonlab/mixin/DhRelativePositionMixin.java` (+16 -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/PositionIntegration.java` (+121 -0) ➕ `mods/horizon-lab/src/test/java/dev/horizonlab/geometry/RelativeTerrainPositionTest.java` (+52 -0) 📝 `packs/START-HERE.txt` (+4 -0) 📝 `packs/mods.lock.json` (+1 -1) 📝 `tests/test_packs.py` (+21 -0) 📝 `tools/Compare-Benchmarks.html` (+2 -1) 📝 `tools/build_mod.py` (+3 -0) _...and 3 more files_ </details> ### 📄 Description A live client profile sampled relative section-position conversion in Distant Horizons’ full-data lookup. This change redirects only that call to equivalent primitive Java arithmetic, avoiding variable division on the eligible path without a cache, native call or retained per-source fields. Original containment, column selection, datapoint search and source contents remain upstream. The pinned library’s unusual negative-coordinate rounding is retained; invalid levels and sign-bit divisors delegate to its original method. Adds an isolated terrain-position pack, disables it in every other profile, captures the actual applied flag, and discloses flag changes in both comparison tools. The hook requires DH 3.3.4. Publisher classes and private fixtures are never bundled. Validation: 30 offline checks pass. An actual publisher differential suite passes 1,525,313 cases, including 1,124,986 invalid-level exceptions, signed-coordinate/power boundaries, selected input levels/all output bytes, integer extrema, reserved bits and one million random positions. The applied Fabric off/on fixture matches 491,520 public lookups across 30 generated owners/six detail levels, with 327,049 populated-column results, unchanged data fingerprints and a verified redirect method in each mode. Performance observations are mixed and warm-up sensitive. The first two-million-lookup observation was 120/225 ms caller CPU. Later six-million sets were 250/261 ms and, after longer warm-up/compilation waits, 331/260 ms. These are fixed-order single forks with three sequential warmed observations, not independent repetitions, statistical speedup estimates, whole-game FPS/RAM or Mac GPU measurements. Numeric-cache and plain-shift candidates were discarded for cost or equivalence failures. The hook remains off in recommended profiles. Windows x64, macOS ARM and Linux x64 checks passed at c6ec0b5 (workflow 37171062262). The independent Linux JAR matches the local binary byte-for-byte; its three two-million-lookup caller CPU observations were 59.7/52.7/52.5 ms upstream versus 56.1/47.9/47.7 ms with the hook. These favor the hook in that fixture, without establishing whole-game or cross-hardware gains. Raw current, independent CI and earlier exploratory observations retain source/protocol limits. The exact JAR reaches the baseline menu without DH and exits 0. Its landscape-world candidate captured 219 frames over 120 seconds with zero exclusions, matching CSV count and unchanged captured visual settings. World save, reload and second save succeeded; the candidate process exited 0 without a crash report or remaining game process. The matching control capture and final viewer pair checks are in progress. Prepares v0.16.0. Final live pair: 221 control / 219 candidate frames and 2,401 ticks each, zero frame exclusions or dropped samples, matched captured settings and first saved cameras. No FPS gain is established. Candidate save/reload/second save and control save passed; both foreground clients exited with code 0. Actual JSON/CSV comparison and mobile viewer checks pass. Sanitized raw results retain warm-up, fixed-order and software-rendering limits. --- <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#2268
No description provided.