[PR #2706] [MERGED] Worldgen: the surface step skips writes that change nothing #4557

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2706
Author: @FusselTV
Created: 10/27/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: perf/surface-skip-same-writes


📝 Commits (1)

  • 3788dff Worldgen: the surface step skips writes that change nothing

📊 Changes

1 file changed (+4 additions, -1 deletions)

View changed files

📝 crates/horizon-world/src/worldgen/material_stage.rs (+4 -1)

📄 Description

🤖 Opened by FusselTV's AI agent (Claude Code, Opus 5.5), not by FusselTV personally.

What and why

Most of the Nether's surface rule (noise_settings/nether.json) ends in netherrack, written over the netherrack the noise step placed. So every solid block paid for a write that changes nothing: the section lookup, two state table reads, the heightmap updates and the fluid check. TerrainChunk's section write already returns early on an unchanged state, but the rest still ran.

What changes:

  • material_stage::Column::set_block leaves a block that already holds the state. A fluid is still marked for post-processing, as every write marks it.

Tests

  • chunkgen_bench, 576 chunks, 1 thread: Nether surface 1.81 → 1.52 ms per chunk; Overworld unchanged (plain stone gets no write).
  • chunkgen_bench --snapshot, seeds 12345 and 1, Nether and Overworld, 24 × 24 chunks: the terrain snapshots (palettes, every block, heightmaps, post-processing, ticks) are byte for byte the same before and after.

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on c7349d757fd0, against upstream/main at cb43e3278, 3 min 3 s)

Check Result
Scope ✅ 1 files, +4 −1
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 320 passed (24 s)
rustfmt ✅ (7 s)
clippy ✅ (54 s)
tests: horizon-world ✅ 242 passed (1 min 35 s)
doc tests ✅ 0 passed (1 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 333 affected, to run in CI (--quick): arrow, attribute_map_queries, attribute_updates, auto_jump, biome_source_codec, biome_temperature, biome_weather, biome_zoom, block_blob, block_collision_scan, block_column, block_entity_anim and 321 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with Claude Code


🔄 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/2706 **Author:** [@FusselTV](https://github.com/FusselTV) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `perf/surface-skip-same-writes` --- ### 📝 Commits (1) - [`3788dff`](https://github.com/horizon-rust/horizon/commit/3788dff6a1cb9b2567c7cbe4ed5a559342808e1b) Worldgen: the surface step skips writes that change nothing ### 📊 Changes **1 file changed** (+4 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-world/src/worldgen/material_stage.rs` (+4 -1) </details> ### 📄 Description > 🤖 Opened by FusselTV's AI agent (Claude Code, Opus 5.5), not by FusselTV personally. ## What and why Most of the Nether's surface rule (`noise_settings/nether.json`) ends in `netherrack`, written over the netherrack the noise step placed. So every solid block paid for a write that changes nothing: the section lookup, two state table reads, the heightmap updates and the fluid check. `TerrainChunk`'s section write already returns early on an unchanged state, but the rest still ran. What changes: - `material_stage::Column::set_block` leaves a block that already holds the state. A fluid is still marked for post-processing, as every write marks it. ## Tests - `chunkgen_bench`, 576 chunks, 1 thread: Nether surface 1.81 → 1.52 ms per chunk; Overworld unchanged (plain stone gets no write). - `chunkgen_bench --snapshot`, seeds 12345 and 1, Nether and Overworld, 24 × 24 chunks: the terrain snapshots (palettes, every block, heightmaps, post-processing, ticks) are byte for byte the same before and after. ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on c7349d757fd0, against upstream/main at cb43e3278, 3 min 3 s) | Check | Result | | --- | --- | | Scope | ✅ 1 files, +4 −1 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 320 passed (24 s) | | rustfmt | ✅ (7 s) | | clippy | ✅ (54 s) | | tests: horizon-world | ✅ 242 passed (1 min 35 s) | | doc tests | ✅ 0 passed (1 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 333 affected, to run in CI (--quick): arrow, attribute_map_queries, attribute_updates, auto_jump, biome_source_codec, biome_temperature, biome_weather, biome_zoom, block_blob, block_collision_scan, block_column, block_entity_anim and 321 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:18:02 +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#4557
No description provided.