[PR #4232] [MERGED] Keep no face shapes from the load-time passes over the collision and support tables #5504

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

📋 Pull Request Information

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

Base: main ← Head: perf/load-time-faces


📝 Commits (1)

  • c8ee23f Keep no face shapes from the load-time passes over the collision and support tables

📊 Changes

3 files changed (+62 additions, -9 deletions)

View changed files

📝 crates/horizon-core/src/geometry/shape/face.rs (+45 -0)
📝 crates/horizon-world/src/block_support.rs (+14 -7)
📝 crates/horizon-world/src/level/data.rs (+3 -2)

📄 Description

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

Server-next W4 (idle memory, plan #3989). Two load-time passes asked every collision and support shape for its six faces, and face_shape keeps each face on the shape (ShapeIdentity::faces). These two passes are analyse_shape in the level data cache, and the support-table precompute in CachedBlockSupportRegistry::from_table. Only the bits computed from the faces are used afterwards, yet the faces stayed alive for the whole run. A heap profile of an idle dedicated server put that at ~39 MB.

  • VoxelShape::face_shape_transient returns the same face as face_shape and does not store a face it had to compute. A face already in the cache is returned as is. Identity semantics are unchanged: an empty or cube-like shape returns itself; any other shape gets a fresh face either way.
  • analyse_shape and the support precompute use it. The support precompute now computes each direction's face once and tests Full, Center and Rigid on that face; before, it computed the face three times.
  • At run time, faces are still computed and cached on first use, as before.

Idle memory A/B

Dedicated server, --profile fast --no-default-features, on playhorizon (--cpus 0-3 --exclusive). RSS 10 s after the first status ping (sn_idle.py), 3 interleaved rounds:

Build Round 1 Round 2 Round 3
main c48d6773c 341 MB 340 MB 342 MB
this PR 302 MB 302 MB 305 MB

That is −38 MB, which matches the profile. Startup time to ready: 3.77–3.92 s for both builds, within noise.

New unit test transient_faces_are_not_kept: same boxes as the cached face, nothing stored, and the cached face is returned once it exists.

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at c48d6773c, 5 min 53 s)

Check Result
Scope ✅ 3 files, +62 −9
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 480 passed (1 min 13 s)
rustfmt ✅ (5 s)
clippy ✅ (1 min 56 s)
tests: horizon-core, horizon-world ✅ 397 passed (2 min 13 s)
doc tests ✅ 0 passed (2 s)
Parity ➖ 177 affected, run in CI (run-parity)

🤖 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/4232 **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/load-time-faces` --- ### 📝 Commits (1) - [`c8ee23f`](https://github.com/horizon-rust/horizon/commit/c8ee23f2b822aa3017bca7307a01a34346bbdc5e) Keep no face shapes from the load-time passes over the collision and support tables ### 📊 Changes **3 files changed** (+62 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-core/src/geometry/shape/face.rs` (+45 -0) 📝 `crates/horizon-world/src/block_support.rs` (+14 -7) 📝 `crates/horizon-world/src/level/data.rs` (+3 -2) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Server-next W4 (idle memory, plan #3989). Two load-time passes asked every collision and support shape for its six faces, and `face_shape` keeps each face on the shape (`ShapeIdentity::faces`). These two passes are `analyse_shape` in the level data cache, and the support-table precompute in `CachedBlockSupportRegistry::from_table`. Only the bits computed from the faces are used afterwards, yet the faces stayed alive for the whole run. A heap profile of an idle dedicated server put that at ~39 MB. - `VoxelShape::face_shape_transient` returns the same face as `face_shape` and does not store a face it had to compute. A face already in the cache is returned as is. Identity semantics are unchanged: an empty or cube-like shape returns itself; any other shape gets a fresh face either way. - `analyse_shape` and the support precompute use it. The support precompute now computes each direction's face once and tests Full, Center and Rigid on that face; before, it computed the face three times. - At run time, faces are still computed and cached on first use, as before. ## Idle memory A/B Dedicated server, `--profile fast --no-default-features`, on playhorizon (`--cpus 0-3 --exclusive`). RSS 10 s after the first status ping (`sn_idle.py`), 3 interleaved rounds: | Build | Round 1 | Round 2 | Round 3 | |---|---|---|---| | main c48d6773c | 341 MB | 340 MB | 342 MB | | this PR | 302 MB | 302 MB | 305 MB | That is −38 MB, which matches the profile. Startup time to ready: 3.77–3.92 s for both builds, within noise. New unit test `transient_faces_are_not_kept`: same boxes as the cached face, nothing stored, and the cached face is returned once it exists. **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at c48d6773c, 5 min 53 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +62 −9 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 480 passed (1 min 13 s) | | rustfmt | ✅ (5 s) | | clippy | ✅ (1 min 56 s) | | tests: horizon-core, horizon-world | ✅ 397 passed (2 min 13 s) | | doc tests | ✅ 0 passed (2 s) | | Parity | ➖ 177 affected, run in CI (`run-parity`) | 🤖 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:13: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#5504
No description provided.