[PR #1268] [MERGED] Cache uniform surface biome cells for 10% faster Nether generation #3471

Closed
opened 2026-11-03 04:09:46 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: perf/surface-biome-cells


📝 Commits (2)

  • cd494e7 Cache uniform resident biome cells during surface generation
  • d3bad12 Merge main into #1268: keep the End shortcut around the cached surface pass

📊 Changes

1 file changed (+159 additions, -3 deletions)

View changed files

📝 crates/horizon-world/src/worldgen/generator.rs (+159 -3)

📄 Description

Surface rules repeatedly run the eight-corner biome zoom even when all candidate quart biomes agree. Cache that equality proof for each cell during one chunk's surface pass and return the shared biome directly. Mixed cells, missing candidates and positions outside the cache use the existing zoom and selected lookup. Rule order, RNG, traversal and resolver queries are unchanged.

Five alternating independent-process release pairs after a discarded pair improve complete Nether generation plus decoration by a median 10.12% (1,024 proto chunks, 900 decorated, one worker; individual gains 7.88–10.32%). Measurements use main 1ec2762f with the separate End optimization applied equally to baseline and candidate; that optimization does not affect the Nether path. Benchmark sources/resources and thin-LTO/one-codegen-unit settings are identical, with no builds, tests or profilers overlapping timing. This independent patch preserves the exact cache-only code delta from the measured candidate.

Persistent-pool checks are exploratory: one-worker fill improves 5.2%; six-worker observations are noisy (-8.5%, +7.1%, +8.1%), so there is no qualified loading-speed claim. Related cold/six-worker generation, a second Nether site and Overworld/End checks show no repeatable regression. Peak RSS varies by at most 0.6%. Fixed-rate Nether flight completes identical work with zero near-player unlit frames.

Validation:

  • Independent branch: release compilation and the focused cache test pass. Fresh pinned Minecraft 26.3 full-phase parity passes 108 chunks: 54 Nether chunks covering all five biomes and lava-ocean sites, plus 54 central/outer End chunks through normal surface traversal. Blocks, quart biomes and canonical block entities match exactly.
  • Measured tree: pr_ready passes public-tree validation, rustfmt, clippy, 232 world tests and doc tests. Across six sites and three dimensions, 48 complete terrain/decorated snapshots produce 36 exact equality checks at one/twelve workers, including heightmaps, ticks, ordered postprocessing, entities, structure metadata, palettes and counts.
  • The focused synthetic test covers uniform/mixed cells, clamped/out-of-cache heights, negative/wrapped coordinates and missing-corner errors.

🔄 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/1268 **Author:** [@rdbtCVS](https://github.com/rdbtCVS) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/surface-biome-cells` --- ### 📝 Commits (2) - [`cd494e7`](https://github.com/horizon-rust/horizon/commit/cd494e74bad04d515d6fedc8b5f6db8f5bf5af1d) Cache uniform resident biome cells during surface generation - [`d3bad12`](https://github.com/horizon-rust/horizon/commit/d3bad123832057bbf86c63f3d47c60e157ccb0ae) Merge main into #1268: keep the End shortcut around the cached surface pass ### 📊 Changes **1 file changed** (+159 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-world/src/worldgen/generator.rs` (+159 -3) </details> ### 📄 Description Surface rules repeatedly run the eight-corner biome zoom even when all candidate quart biomes agree. Cache that equality proof for each cell during one chunk's surface pass and return the shared biome directly. Mixed cells, missing candidates and positions outside the cache use the existing zoom and selected lookup. Rule order, RNG, traversal and resolver queries are unchanged. Five alternating independent-process release pairs after a discarded pair improve complete Nether generation plus decoration by a median **10.12%** (1,024 proto chunks, 900 decorated, one worker; individual gains 7.88–10.32%). Measurements use main `1ec2762f` with the separate End optimization applied equally to baseline and candidate; that optimization does not affect the Nether path. Benchmark sources/resources and thin-LTO/one-codegen-unit settings are identical, with no builds, tests or profilers overlapping timing. This independent patch preserves the exact cache-only code delta from the measured candidate. Persistent-pool checks are exploratory: one-worker fill improves 5.2%; six-worker observations are noisy (-8.5%, +7.1%, +8.1%), so there is no qualified loading-speed claim. Related cold/six-worker generation, a second Nether site and Overworld/End checks show no repeatable regression. Peak RSS varies by at most 0.6%. Fixed-rate Nether flight completes identical work with zero near-player unlit frames. Validation: - Independent branch: release compilation and the focused cache test pass. Fresh pinned Minecraft 26.3 full-phase parity passes 108 chunks: 54 Nether chunks covering all five biomes and lava-ocean sites, plus 54 central/outer End chunks through normal surface traversal. Blocks, quart biomes and canonical block entities match exactly. - Measured tree: `pr_ready` passes public-tree validation, rustfmt, clippy, 232 world tests and doc tests. Across six sites and three dimensions, 48 complete terrain/decorated snapshots produce 36 exact equality checks at one/twelve workers, including heightmaps, ticks, ordered postprocessing, entities, structure metadata, palettes and counts. - The focused synthetic test covers uniform/mixed cells, clamped/out-of-cache heights, negative/wrapped coordinates and missing-corner errors. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:09:46 +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#3471
No description provided.