[PR #1004] [MERGED] Sculk: ask each chunk once a tick whether its sensors tick #2979

Closed
opened 2026-11-02 16:00:34 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: perf/sculk-chunk-ticks


📝 Commits (1)

  • 24428c4 Sculk: ask each chunk once a tick whether its sensors tick

📊 Changes

1 file changed (+29 additions, -16 deletions)

View changed files

📝 crates/horizon-client/src/game/sculk.rs (+29 -16)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

What

tick_sculk_blocks (vanilla's block entity phase for sculk sensors, calibrated sensors, shriekers and catalysts) asked, for every sculk block entity in the loaded area, whether its chunk ticks, and then whether the 8 chunks around it tick too: 10 chunk_ticks calls per sensor per tick. Each one cloned the ticket levels' Arc and made two hash lookups. A loaded area around spawn holds a few thousand sculk block entities (deep dark, sculk patches), and they share a few hundred chunks.

Now each chunk is asked once per tick, in a small FxHashMap, and the loop gets the same answers. The sensors still tick in the index's order, and each still gets whether the chunks around it tick (VibrationSystem.Ticker's adjacent). Nothing a sculk tick does loads, unloads or lights a chunk or moves a ticket, so working the answers out before the loop gives what the loop asked for before.

Why

Brief perf-server-12, task 3 (by profile). On the ThinkPad (i7-7500U), perf record of the dedicated server with one walking bot put tick_sculk_blocks at 6.4 % of the server thread (1.3 ms of a 13.7 ms tick), 3.45 % of it in chunk_ticks and most of the rest in the loop's own hashing.

Numbers

Mac mini (M4 Pro, busy with other sessions at 85–90 % CPU), dedicated server, seed 12345, view and simulation distance 10, 10 horizon-bots --behaviour mixed --explore-speed 0.8 bots for 180 s; HORIZON_SPIKES=0 with the span filter lowered to 0 ms (local probe, both builds) so every span of every tick is logged; the last 2400 ticks. Builds --profile fast, alternated base/new/base/new.

10 bots tick avg (ms) tick_sculk_blocks (ms/tick)
base 1 4.49 0.228
new 1 4.26 0.135
base 2 4.43 0.204
new 2 4.23 0.138

tick_sculk_blocks is 37 % shorter. What is left is the vibration tickers themselves and the block entity lookups.

Checks

On the rebased branch (24428c4f, on main 5c88c46c), Mac mini:

  • cargo fmt --all -- --check: clean
  • cargo clippy --workspace --all-targets -- -D warnings: clean
  • cargo test -p horizon-client --lib: 922 passed (combined branch, below)
  • tools/parity.py sculk: 1 passed
  • With the other two perf-server-12 branches on main ee59df13: tools/parity.py --changed origin/main ran 98 harnesses, 98 passed (including natural_spawn, spawn_rules, sculk, mob_ai, world_spawn), and cargo test -p horizon-client --lib passed 922.

Needs Ludovic

Nothing.

🤖 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/1004 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/19/2026 **Status:** ✅ Merged **Merged:** 10/19/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/sculk-chunk-ticks` --- ### 📝 Commits (1) - [`24428c4`](https://github.com/horizon-rust/horizon/commit/24428c4f83023f000870e0243a5b07440c766385) Sculk: ask each chunk once a tick whether its sensors tick ### 📊 Changes **1 file changed** (+29 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/sculk.rs` (+29 -16) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What `tick_sculk_blocks` (vanilla's block entity phase for sculk sensors, calibrated sensors, shriekers and catalysts) asked, for every sculk block entity in the loaded area, whether its chunk ticks, and then whether the 8 chunks around it tick too: 10 `chunk_ticks` calls per sensor per tick. Each one cloned the ticket levels' `Arc` and made two hash lookups. A loaded area around spawn holds a few thousand sculk block entities (deep dark, sculk patches), and they share a few hundred chunks. Now each chunk is asked once per tick, in a small `FxHashMap`, and the loop gets the same answers. The sensors still tick in the index's order, and each still gets whether the chunks around it tick (`VibrationSystem.Ticker`'s `adjacent`). Nothing a sculk tick does loads, unloads or lights a chunk or moves a ticket, so working the answers out before the loop gives what the loop asked for before. ## Why Brief perf-server-12, task 3 (by profile). On the ThinkPad (i7-7500U), `perf record` of the dedicated server with one walking bot put `tick_sculk_blocks` at 6.4 % of the server thread (1.3 ms of a 13.7 ms tick), 3.45 % of it in `chunk_ticks` and most of the rest in the loop's own hashing. ## Numbers Mac mini (M4 Pro, busy with other sessions at 85–90 % CPU), dedicated server, seed 12345, view and simulation distance 10, 10 `horizon-bots --behaviour mixed --explore-speed 0.8` bots for 180 s; `HORIZON_SPIKES=0` with the span filter lowered to 0 ms (local probe, both builds) so every span of every tick is logged; the last 2400 ticks. Builds `--profile fast`, alternated base/new/base/new. | 10 bots | tick avg (ms) | `tick_sculk_blocks` (ms/tick) | |---|---:|---:| | base 1 | 4.49 | 0.228 | | new 1 | 4.26 | **0.135** | | base 2 | 4.43 | 0.204 | | new 2 | 4.23 | **0.138** | `tick_sculk_blocks` is 37 % shorter. What is left is the vibration tickers themselves and the block entity lookups. ## Checks On the rebased branch (24428c4f, on main 5c88c46c), Mac mini: - `cargo fmt --all -- --check`: clean - `cargo clippy --workspace --all-targets -- -D warnings`: clean - `cargo test -p horizon-client --lib`: 922 passed (combined branch, below) - `tools/parity.py sculk`: 1 passed - With the other two perf-server-12 branches on main ee59df13: `tools/parity.py --changed origin/main` ran 98 harnesses, 98 passed (including `natural_spawn`, `spawn_rules`, `sculk`, `mob_ai`, `world_spawn`), and `cargo test -p horizon-client --lib` passed 922. ## Needs Ludovic Nothing. 🤖 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-02 16:00:34 +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#2979
No description provided.