[PR #2011] [MERGED] Name tags: collect the ridden mobs once, not per tag #3936

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

📋 Pull Request Information

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

Base: main ← Head: perf/vehicle-set-once


📝 Commits (2)

  • dcc5899 Name tags: collect the ridden mobs once, not per tag
  • d3a1ce1 Merge remote-tracking branch 'origin/main' into perf/vehicle-set-once

📊 Changes

1 file changed (+5 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game/names.rs (+5 -1)

📄 Description

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

game/names.rs, name tags: is_vehicle asked self.mobs.iter().any(|o| o.extra.mount == Some(m.id)) inside the loop over the tags, so every tagged mob rescanned every loaded mob — quadratic in the number of loaded mobs, every frame, for a fact that does not change within the frame.

The ridden ids are collected once before the loop and the tag asks the set.

No behaviour change: is_vehicle means "some mob is riding this one", which is what the set holds; a rider that appears mid-frame is still not possible, the list is not mutated while the tags are built.

No number: tools/graphics_bench.py cannot run on this machine (it needs vscreen, a Linux virtual screen), and --benchmark village sits at cpu_p50 0.326 ms with barely any mobs, so the quadratic term is not visible there. The change removes the rescan, it does not claim a measured speedup. The scenes where it matters are the ones with many loaded mobs, and those are not in the local harness.

cargo fmt --all --check and cargo clippy -p horizon-client --all-targets -- -D warnings pass.


🔄 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/2011 **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/vehicle-set-once` --- ### 📝 Commits (2) - [`dcc5899`](https://github.com/horizon-rust/horizon/commit/dcc5899692842530d24647072c6208278bd4e932) Name tags: collect the ridden mobs once, not per tag - [`d3a1ce1`](https://github.com/horizon-rust/horizon/commit/d3a1ce1d7a284e4b2b28590515fba79ac083016a) Merge remote-tracking branch 'origin/main' into perf/vehicle-set-once ### 📊 Changes **1 file changed** (+5 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/names.rs` (+5 -1) </details> ### 📄 Description > 🤖 Opened by Alexander's AI agent (Hermes), not by Alexander himself. `game/names.rs`, name tags: `is_vehicle` asked `self.mobs.iter().any(|o| o.extra.mount == Some(m.id))` inside the loop over the tags, so every tagged mob rescanned every loaded mob — quadratic in the number of loaded mobs, every frame, for a fact that does not change within the frame. The ridden ids are collected once before the loop and the tag asks the set. No behaviour change: `is_vehicle` means "some mob is riding this one", which is what the set holds; a rider that appears mid-frame is still not possible, the list is not mutated while the tags are built. No number: `tools/graphics_bench.py` cannot run on this machine (it needs `vscreen`, a Linux virtual screen), and `--benchmark village` sits at `cpu_p50 0.326 ms` with barely any mobs, so the quadratic term is not visible there. The change removes the rescan, it does not claim a measured speedup. The scenes where it matters are the ones with many loaded mobs, and those are not in the local harness. `cargo fmt --all --check` and `cargo clippy -p horizon-client --all-targets -- -D warnings` pass. --- <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:23 +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#3936
No description provided.