[PR #796] [MERGED] Optimize bulk density arithmetic, Beardifier and Perlin sampling #2819

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

📋 Pull Request Information

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

Base: main ← Head: t3/optimize-noise-aquifers


📝 Commits (6)

  • ce77a41 Specialize unary density evaluation per bulk buffer
  • eb37890 Record repository PR self-check
  • 594b502 Remove generated noise benchmark artifacts from PR
  • c47b30f Optimize binary density, Beardifier and Perlin sampling
  • 0b5f0a3 Document 1 2 4 and 8 worker scaling measurements
  • 99b07dc Merge remote-tracking branch 'origin/main' into pr/796

📊 Changes

5 files changed (+473 additions, -21 deletions)

View changed files

📝 crates/horizon-core/src/density/arithmetic.rs (+269 -9)
📝 crates/horizon-core/src/density/beardifier.rs (+7 -4)
📝 crates/horizon-core/src/density/tests.rs (+112 -0)
📝 crates/horizon-core/src/noise/perlin.rs (+21 -8)
➕ docs/noise-aquifer-benchmark.md (+64 -0)

📄 Description

What and why

Supersedes #768. Reduce repeated work in Horizon's density/noise evaluation:

  • Dispatch unary and binary arithmetic once per bulk buffer, with bit-exact floating-point and child-failure tests.
  • Resolve the shared Beardifier kernel once per sampled position.
  • Reuse Perlin X-column permutations across the Y loop.

Five alternating initialized-generator pairs per workload show Overworld whole-terrain time of 12.685 → 10.069 ms/chunk (20.62%) with one worker and 4.046 → 3.360 (16.96%) with four. Terrain plus decoration improves 17.63% / 15.40%. A second seed/site improves terrain 21.63% / 18.88%. Times are complete terrain wall elapsed divided by 256 input chunks, without a thread multiplier.

A separate direct comparison against the unary-only PR revision measures the three additions together: 10.913 → 10.035 ms/chunk (8.05%) with one worker and 3.537 → 3.312 (6.35%) with four. Combined terrain plus decoration improves 6.12% / 5.19%. Other dimension results, paired ranges, exclusions and limitations are in the benchmark report. Raw evidence and private fixtures remain outside the repository; the artifact cleanup is preserved.

Vanilla reference

Pinned Java Edition 26.3 UnaryFunction / BinaryFunction volume samplers, Beardifier sampling, and PerlinNoise / SmearedPerlinNoise volume behavior. Fresh client/server oracles pass for density (15,524,627 lines per side), noise (1,443,539), Beardifier/structure density (1,360,095), and terrain fill (7,950,873).

Also passed: 193 targeted optimized Rust tests and 24/24 exact terrain/decorated region comparisons across three dimensions, two seeds/sites and one/four workers. Snapshots include blocks and palettes, biomes, entities/block entities, complete ticks, all six heightmaps, ordered postprocessing and actual non-air counts.

Self-check

pr_ready (tools/pr_ready.py --quick on archlinux, against origin/main at e4f8154cb, 32 s)

Check Result
Scope ✅ 5 files, +458 −21
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (5 s)
clippy ✅ (25 s)
tests: horizon-core ✅ 96 passed (1 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Quick mode avoids rerunning every vanilla suite; the relevant fresh Java suites and full affected-field comparisons were run separately as listed above.


🔄 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/796 **Author:** [@rdbtCVS](https://github.com/rdbtCVS) **Created:** 10/18/2026 **Status:** ✅ Merged **Merged:** 10/19/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `t3/optimize-noise-aquifers` --- ### 📝 Commits (6) - [`ce77a41`](https://github.com/horizon-rust/horizon/commit/ce77a4189d157747c9f1e250422c0c04342b251c) Specialize unary density evaluation per bulk buffer - [`eb37890`](https://github.com/horizon-rust/horizon/commit/eb3789038e3184c98a1459fe638947200217d360) Record repository PR self-check - [`594b502`](https://github.com/horizon-rust/horizon/commit/594b50278044df6b72b641cd02d5050925c86203) Remove generated noise benchmark artifacts from PR - [`c47b30f`](https://github.com/horizon-rust/horizon/commit/c47b30fcf0db87b8023e6784d941a4f06524b453) Optimize binary density, Beardifier and Perlin sampling - [`0b5f0a3`](https://github.com/horizon-rust/horizon/commit/0b5f0a3edf49eddbf010d34ce416e1f0a2a40b77) Document 1 2 4 and 8 worker scaling measurements - [`99b07dc`](https://github.com/horizon-rust/horizon/commit/99b07dc810eb42d2f37f18c5ed9b0046fcfad9bf) Merge remote-tracking branch 'origin/main' into pr/796 ### 📊 Changes **5 files changed** (+473 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-core/src/density/arithmetic.rs` (+269 -9) 📝 `crates/horizon-core/src/density/beardifier.rs` (+7 -4) 📝 `crates/horizon-core/src/density/tests.rs` (+112 -0) 📝 `crates/horizon-core/src/noise/perlin.rs` (+21 -8) ➕ `docs/noise-aquifer-benchmark.md` (+64 -0) </details> ### 📄 Description ## What and why Supersedes #768. Reduce repeated work in Horizon's density/noise evaluation: - Dispatch unary and binary arithmetic once per bulk buffer, with bit-exact floating-point and child-failure tests. - Resolve the shared Beardifier kernel once per sampled position. - Reuse Perlin X-column permutations across the Y loop. Five alternating initialized-generator pairs per workload show Overworld whole-terrain time of **12.685 → 10.069 ms/chunk (20.62%)** with one worker and **4.046 → 3.360 (16.96%)** with four. Terrain plus decoration improves **17.63% / 15.40%**. A second seed/site improves terrain **21.63% / 18.88%**. Times are complete terrain wall elapsed divided by 256 input chunks, without a thread multiplier. A separate direct comparison against the unary-only PR revision measures the three additions together: **10.913 → 10.035 ms/chunk (8.05%)** with one worker and **3.537 → 3.312 (6.35%)** with four. Combined terrain plus decoration improves **6.12% / 5.19%**. Other dimension results, paired ranges, exclusions and limitations are in the [benchmark report](https://github.com/rdbtCVS/horizon/blob/t3/optimize-noise-aquifers/docs/noise-aquifer-benchmark.md). Raw evidence and private fixtures remain outside the repository; the artifact cleanup is preserved. ## Vanilla reference Pinned Java Edition 26.3 `UnaryFunction` / `BinaryFunction` volume samplers, `Beardifier` sampling, and `PerlinNoise` / `SmearedPerlinNoise` volume behavior. Fresh client/server oracles pass for density (15,524,627 lines per side), noise (1,443,539), Beardifier/structure density (1,360,095), and terrain fill (7,950,873). Also passed: **193 targeted optimized Rust tests** and **24/24 exact terrain/decorated region comparisons** across three dimensions, two seeds/sites and one/four workers. Snapshots include blocks and palettes, biomes, entities/block entities, complete ticks, all six heightmaps, ordered postprocessing and actual non-air counts. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on archlinux, against origin/main at e4f8154cb, 32 s) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +458 −21 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (5 s) | | clippy | ✅ (25 s) | | tests: horizon-core | ✅ 96 passed (1 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Quick mode avoids rerunning every vanilla suite; the relevant fresh Java suites and full affected-field comparisons were run separately as listed above. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:59:18 +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#2819
No description provided.