[PR #1993] [MERGED] Frames: one scan for breaking progress, and no name formatting per crack #3921

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

📋 Pull Request Information

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

Base: main ← Head: perf/no-double-cracks-and-ticker-copy


📝 Commits (3)

  • 258dd85 Frames: one scan for breaking progress, and no name formatting per crack
  • 1dcb33f Merge main into perf/no-double-cracks-and-ticker-copy
  • 68f23b9 Merge remote-tracking branch 'origin/main' into perf/no-double-cracks-and-ticker-copy

📊 Changes

1 file changed (+21 additions, -7 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+21 -7)

📄 Description

🤖 Opened by Alexander's AI agent (Hermes), not by Alexander himself.

entity_geometry ran the breaking-progress pass twice per frame, and each run formatted a sprite name for every crack it found.

  • Game::cracks is now called once, at the top of entity_geometry, and both passes read that list: the block-entity pass that draws render_breaking, and the overlay pass near the end of the same function.
  • cracks looks the stage sprite up in a const DESTROY_STAGES: [&str; 10] instead of format!("block/destroy_stage_{stage}"), so a crack costs one map lookup and no allocation.

Behaviour is unchanged. The same ten sprite names are used, a stage above 9 still finds no sprite and the crack is skipped as before, and the two passes cannot disagree now: nothing between them touches self.mining or self.destroying (both are only read there), so the list the second pass rebuilt was always identical to the first one.

No before/after number, and I will not invent one: none of the benchmark scenes breaks a block, so tools/perf_bench.py cannot show this. The change removes one scan of the destroying map and two format!s per crack per frame; it is structure, not a measured win. If you would rather see a number, the honest way is the count of cracks() calls per frame, which goes from two to one, and that is what the diff does.

How tested:

  • cargo clippy -p horizon-client --all-targets -- -D warnings
  • cargo fmt --all --check

The pr_ready block follows as a comment.


🔄 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/1993 **Author:** [@Domanffe](https://github.com/Domanffe) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/no-double-cracks-and-ticker-copy` --- ### 📝 Commits (3) - [`258dd85`](https://github.com/horizon-rust/horizon/commit/258dd8561df05c8493a14d63d4eaa89074bb780b) Frames: one scan for breaking progress, and no name formatting per crack - [`1dcb33f`](https://github.com/horizon-rust/horizon/commit/1dcb33f11124e6948967dae5c347d01537abe817) Merge main into perf/no-double-cracks-and-ticker-copy - [`68f23b9`](https://github.com/horizon-rust/horizon/commit/68f23b99161bc3d5ef10a0d586e5cba21047c2b9) Merge remote-tracking branch 'origin/main' into perf/no-double-cracks-and-ticker-copy ### 📊 Changes **1 file changed** (+21 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+21 -7) </details> ### 📄 Description > 🤖 Opened by Alexander's AI agent (Hermes), not by Alexander himself. `entity_geometry` ran the breaking-progress pass twice per frame, and each run formatted a sprite name for every crack it found. - `Game::cracks` is now called once, at the top of `entity_geometry`, and both passes read that list: the block-entity pass that draws `render_breaking`, and the overlay pass near the end of the same function. - `cracks` looks the stage sprite up in a `const DESTROY_STAGES: [&str; 10]` instead of `format!("block/destroy_stage_{stage}")`, so a crack costs one map lookup and no allocation. Behaviour is unchanged. The same ten sprite names are used, a stage above 9 still finds no sprite and the crack is skipped as before, and the two passes cannot disagree now: nothing between them touches `self.mining` or `self.destroying` (both are only read there), so the list the second pass rebuilt was always identical to the first one. No before/after number, and I will not invent one: none of the benchmark scenes breaks a block, so `tools/perf_bench.py` cannot show this. The change removes one scan of the `destroying` map and two `format!`s per crack per frame; it is structure, not a measured win. If you would rather see a number, the honest way is the count of `cracks()` calls per frame, which goes from two to one, and that is what the diff does. How tested: - `cargo clippy -p horizon-client --all-targets -- -D warnings` - `cargo fmt --all --check` The `pr_ready` block follows as a comment. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:13:17 +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#3921
No description provided.