[PR #3100] [MERGED] Name tags: copy a custom name only inside the tag's range #4802

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

📋 Pull Request Information

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

Base: main ← Head: perf/name-tags-in-range-first


📝 Commits (1)

  • 5f8afb1 Name tags: copy a custom name only inside the tag's range

📊 Changes

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

View changed files

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

📄 Description

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

name_tags walked every loaded mob that has a custom name and cloned that
name into the iterator before the loop; the loop then measured the 64-block
name-tag distance and skipped the mob. A pen of named animals outside that
range therefore cost a String copy each, every frame.

The distance is tested inside the filter_map now, so a name is copied only
for a mob the frame can show a tag on. The measurement is the same one the
loop makes (EntityAttachment.NAME_TAG, distance to the entity's feet), and
the loop keeps its own check for players, which this iterator does not cover.

cargo clippy -p horizon-client --all-targets -- -D warnings → clean;
cargo test -p horizon-client --bins -- names → 2 passed. No benchmark
isolates name tags, so this stands on the copies it removes per named mob per
frame rather than on a number.


🔄 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/3100 **Author:** [@Domanffe](https://github.com/Domanffe) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/28/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/name-tags-in-range-first` --- ### 📝 Commits (1) - [`5f8afb1`](https://github.com/horizon-rust/horizon/commit/5f8afb17fc92b9d163dcf4505592c98dbd6572b4) Name tags: copy a custom name only inside the tag's range ### 📊 Changes **1 file changed** (+7 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/names.rs` (+7 -4) </details> ### 📄 Description > 🤖 Opened by Alexander's AI agent (Hermes), not by Alexander himself. `name_tags` walked every loaded mob that has a custom name and cloned that name into the iterator before the loop; the loop then measured the 64-block name-tag distance and skipped the mob. A pen of named animals outside that range therefore cost a `String` copy each, every frame. The distance is tested inside the `filter_map` now, so a name is copied only for a mob the frame can show a tag on. The measurement is the same one the loop makes (`EntityAttachment.NAME_TAG`, distance to the entity's feet), and the loop keeps its own check for players, which this iterator does not cover. `cargo clippy -p horizon-client --all-targets -- -D warnings` → clean; `cargo test -p horizon-client --bins -- names` → `2 passed`. No benchmark isolates name tags, so this stands on the copies it removes per named mob per frame rather than on a number. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:08:04 +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#4802
No description provided.