[PR #658] [MERGED] Sculk: find a loaded chunk's sensors from its palettes, not every block (#489) #2705

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

📋 Pull Request Information

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

Base: main ← Head: fix/sculk-scan-palette


📝 Commits (1)

  • cceda07 Sculk: find a loaded chunk's sensors from its palettes, not every block

📊 Changes

1 file changed (+8 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/game/sculk.rs (+8 -0)

📄 Description

What

When chunks arrive, the sculk index (sculk_sync_index, every 10 ticks) looks through them for sculk sensors, calibrated sensors, shriekers and catalysts. It unpacked and tested all 4,096 blocks of every section that wasn't uniform: right after a world loads, that is every resident chunk at once, 23–26 ms of tick_sculk_blocks in the first 100 ticks, up to 9 ms in one frame in the world below, more at larger render distances. Part of #489's slow first frames (perf-server-2 measured 129 ms of sculk ticking there).

A section whose palette (maybe_has) holds no sculk state has no sculk block, so it is passed over without reading its blocks. Sections that may hold one are scanned exactly as before.

Same results

The palette contains every state of the section (and possibly unused ones), so a section skipped here had no sculk block; the uniform-section rule and the scan of the others are unchanged, so the same blocks are found in the same order. The sculk harness is in the parity run below.

Results

The same world, base/new/base/new, thread CPU time of tick_sculk_blocks from the probe's span totals:

Same world and settings main this PR main this PR
tick_sculk_blocks, first 100 ticks 23.4 ms 0.6 ms 25.8 ms 0.9 ms
tick_sculk_blocks, ticks 100–1100 7.0 ms 2.8 ms 2.8 ms 2.9 ms
Slowest frame's tick_sculk_blocks 5.0 ms < 0.5 ms 9.3 ms < 0.5 ms

How it was measured

  • Machine: Mac mini M4 Pro (14 cores, Metal), shared with other agents' builds and harnesses (load average 60–110 during these runs), so absolute times swing from run to run: compare columns of the same table. Tick times are the integrated server tick in thread CPU time (a local, uncommitted probe times Game::tick with CLOCK_THREAD_CPUTIME_ID, so time spent descheduled doesn't count; the same probe sums the existing spans per tick).
  • World: seed 1234, creative, next to the village of the village benchmark scene (-960, 66, 176), night (time set 18000, advance_time false), a fenced pen with 400 summoned mobs (80 villagers, 80 cows, 80 sheep, 60 zombies, 60 chickens, 40 pigs), about 510 mobs in all. Saved once and restored before every run. Render distance 12, offscreen 1280×720, fast profile (release without LTO).
  • Run: load, wait until no chunk is pending, 300 ticks of warm-up, then bench 40 (about 800 ticks). Builds interleaved base/new.

Self-check

Run on one integration commit holding this PR and the four other server-tick PRs of this round (structure starts, collision scans, entity portal checks, sculk scan, pathfinder caches), which touch separate code:

  • cargo fmt --all --check: clean.
  • cargo clippy --workspace --all-targets -- -D warnings: clean.
  • cargo test -p horizon-client --lib: 787 passed, 0 failed (10 ignored). cargo test -p horizon-world -p horizon-core: all passed.
  • Local parity, tools/parity.py --changed origin/main on the integration commit (all five PRs together, 309 harnesses depend on the changed files): 194 passed, 0 failed; the other 115 did not run because the run hit the 2 h background limit. The passes are in the shared pass cache, so a rerun of the same tree only runs the remaining 115.

Nothing needs Ludovic.

🤖 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/658 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/17/2026 **Status:** ✅ Merged **Merged:** 10/17/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/sculk-scan-palette` --- ### 📝 Commits (1) - [`cceda07`](https://github.com/horizon-rust/horizon/commit/cceda07476b2b15f7638d5a5b25269dd8611ab86) Sculk: find a loaded chunk's sensors from its palettes, not every block ### 📊 Changes **1 file changed** (+8 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/sculk.rs` (+8 -0) </details> ### 📄 Description ## What When chunks arrive, the sculk index (`sculk_sync_index`, every 10 ticks) looks through them for sculk sensors, calibrated sensors, shriekers and catalysts. It unpacked and tested all 4,096 blocks of every section that wasn't uniform: right after a world loads, that is every resident chunk at once, **23–26 ms of `tick_sculk_blocks` in the first 100 ticks, up to 9 ms in one frame** in the world below, more at larger render distances. Part of #489's slow first frames (perf-server-2 measured 129 ms of sculk ticking there). A section whose palette (`maybe_has`) holds no sculk state has no sculk block, so it is passed over without reading its blocks. Sections that may hold one are scanned exactly as before. ## Same results The palette contains every state of the section (and possibly unused ones), so a section skipped here had no sculk block; the uniform-section rule and the scan of the others are unchanged, so the same blocks are found in the same order. The `sculk` harness is in the parity run below. ## Results The same world, base/new/base/new, thread CPU time of `tick_sculk_blocks` from the probe's span totals: | Same world and settings | `main` | this PR | `main` | this PR | | --- | ---: | ---: | ---: | ---: | | `tick_sculk_blocks`, first 100 ticks | 23.4 ms | **0.6 ms** | 25.8 ms | **0.9 ms** | | `tick_sculk_blocks`, ticks 100–1100 | 7.0 ms | 2.8 ms | 2.8 ms | 2.9 ms | | Slowest frame's `tick_sculk_blocks` | 5.0 ms | < 0.5 ms | 9.3 ms | < 0.5 ms | ### How it was measured - **Machine:** Mac mini M4 Pro (14 cores, Metal), shared with other agents' builds and harnesses (load average 60–110 during these runs), so absolute times swing from run to run: compare columns of the same table. Tick times are the integrated server tick in **thread CPU time** (a local, uncommitted probe times `Game::tick` with `CLOCK_THREAD_CPUTIME_ID`, so time spent descheduled doesn't count; the same probe sums the existing `spans` per tick). - **World:** seed 1234, creative, next to the village of the `village` benchmark scene (-960, 66, 176), night (`time set 18000`, `advance_time false`), a fenced pen with 400 summoned mobs (80 villagers, 80 cows, 80 sheep, 60 zombies, 60 chickens, 40 pigs), about 510 mobs in all. Saved once and restored before every run. Render distance 12, offscreen 1280×720, `fast` profile (release without LTO). - **Run:** load, wait until no chunk is pending, 300 ticks of warm-up, then `bench 40` (about 800 ticks). Builds interleaved base/new. ### Self-check Run on one integration commit holding this PR and the four other server-tick PRs of this round (structure starts, collision scans, entity portal checks, sculk scan, pathfinder caches), which touch separate code: - `cargo fmt --all --check`: clean. - `cargo clippy --workspace --all-targets -- -D warnings`: clean. - `cargo test -p horizon-client --lib`: 787 passed, 0 failed (10 ignored). `cargo test -p horizon-world -p horizon-core`: all passed. - Local parity, `tools/parity.py --changed origin/main` on the integration commit (all five PRs together, 309 harnesses depend on the changed files): **194 passed, 0 failed**; the other 115 did not run because the run hit the 2 h background limit. The passes are in the shared pass cache, so a rerun of the same tree only runs the remaining 115. Nothing needs Ludovic. 🤖 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 15:58:24 +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#2705
No description provided.