[PR #4722] [MERGED] Server perf: sculk and portal checks no longer cost per mob per tick #5805

Closed
opened 2026-11-03 05:15:08 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: perf/sculk-portal-per-mob


📝 Commits (1)

  • 51629f9 Server perf: sculk and portal checks no longer cost per mob per tick

📊 Changes

2 files changed (+55 additions, -28 deletions)

View changed files

📝 crates/horizon-client/src/game/nether_portal.rs (+25 -14)
📝 crates/horizon-client/src/game/sculk.rs (+30 -14)

📄 Description

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

What

Two per-mob costs that ran on every server tick are gone:

  • Sculk (tick_sculk_entities):
    • whether the block under a mob is climbable, or a redstone ore, now comes from per-state tables built with the others in sculk_prepare, instead of a tag lookup by string plus an Arc<str> clone for every mob;
    • a step knows whether a warden made it from its caller, instead of scanning every mob.
  • Portals (entity_portals):
    • canUsePortal is asked only for the entities that have a portal state (in a portal or cooling down from one), not for every mob, whose check scanned every server player;
    • the per-tick positions map is an FxHashMap.

Behaviour is unchanged: same tables, same order, same events.

Numbers

Live on the official server (62 players, 1,445 mobs, horizon-server report, 20:35Z): tick_sculk_entities 2.0 ms and entity_portals 1.5 ms of a 47.9 ms tick (7%).

A/B on the Mac mini, 60 server-mix bots, view/simulation distance 3, horizon-report 120 (ms per tick; the machine was busy, so whole-tick MSPT is noise):

sculk entities entity portals
main, run 1 1.02 0.82
main, run 2 1.17 0.90
this PR, run 1 0.84 0.49
this PR, run 2 0.81 0.50

That is about −25% and −44%, so roughly 1.5 ms of the live server's 3.5 ms. Most of what remains in sculk is the vibration events themselves.

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 571e0e534, 9 min 2 s)

Check Result
Scope ✅ 2 files, +55 −28
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 482 passed (3 min 28 s)
rustfmt ✅ (10 s)
clippy ✅ (2 min 16 s)
tests: horizon-client ✅ 1146 passed (2 min 29 s)
doc tests ✅ 0 passed (2 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 33 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, forced_end, friends_integration, hardcore_respawn, lan_integration, locator_bar and 21 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/4722 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/sculk-portal-per-mob` --- ### 📝 Commits (1) - [`51629f9`](https://github.com/horizon-rust/horizon/commit/51629f9085f8047c827cbae55cab6698331292d9) Server perf: sculk and portal checks no longer cost per mob per tick ### 📊 Changes **2 files changed** (+55 additions, -28 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/nether_portal.rs` (+25 -14) 📝 `crates/horizon-client/src/game/sculk.rs` (+30 -14) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What Two per-mob costs that ran on every server tick are gone: - **Sculk** (`tick_sculk_entities`): - whether the block under a mob is climbable, or a redstone ore, now comes from per-state tables built with the others in `sculk_prepare`, instead of a tag lookup by string plus an `Arc<str>` clone for every mob; - a step knows whether a warden made it from its caller, instead of scanning every mob. - **Portals** (`entity_portals`): - `canUsePortal` is asked only for the entities that have a portal state (in a portal or cooling down from one), not for every mob, whose check scanned every server player; - the per-tick positions map is an `FxHashMap`. Behaviour is unchanged: same tables, same order, same events. ## Numbers Live on the official server (62 players, 1,445 mobs, `horizon-server report`, 20:35Z): `tick_sculk_entities` 2.0 ms and `entity_portals` 1.5 ms of a 47.9 ms tick (7%). A/B on the Mac mini, 60 server-mix bots, view/simulation distance 3, `horizon-report 120` (ms per tick; the machine was busy, so whole-tick MSPT is noise): | | sculk entities | entity portals | |---|---|---| | main, run 1 | 1.02 | 0.82 | | main, run 2 | 1.17 | 0.90 | | this PR, run 1 | 0.84 | 0.49 | | this PR, run 2 | 0.81 | 0.50 | That is about −25% and −44%, so roughly 1.5 ms of the live server's 3.5 ms. Most of what remains in sculk is the vibration events themselves. **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 571e0e534, 9 min 2 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +55 −28 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 482 passed (3 min 28 s) | | rustfmt | ✅ (10 s) | | clippy | ✅ (2 min 16 s) | | tests: horizon-client | ✅ 1146 passed (2 min 29 s) | | doc tests | ✅ 0 passed (2 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 33 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, forced_end, friends_integration, hardcore_respawn, lan_integration, locator_bar and 21 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 05:15:08 +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#5805
No description provided.