[PR #2042] [MERGED] Tooltips: compare the hidden component id without a UTF-16 copy #3962

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

📋 Pull Request Information

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

Base: main ← Head: perf/tooltip-component-compare


📝 Commits (2)

  • 73bbbd3 Tooltips: compare the hidden component id without a UTF-16 copy
  • dfefb6d Merge remote-tracking branch 'origin/main' into perf/tooltip-component-compare

📊 Changes

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

View changed files

📝 crates/horizon-client/src/item_tooltip.rs (+3 -4)

📄 Description

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

TooltipDisplay::shows turned the component id into a UTF-16 JavaString on every call, just to compare it with the NBT string it is looking for. A hovered stack's tooltip asks this up to a dozen times per frame, so a hover costs a dozen small heap allocations per frame for a read-only test.

The comparison walks the stored string against component.encode_utf16() directly, which is the same sequence JavaString::from would have collected.

The pr_ready --quick 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/2042 **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/tooltip-component-compare` --- ### 📝 Commits (2) - [`73bbbd3`](https://github.com/horizon-rust/horizon/commit/73bbbd3ee8ead8624788812f9818e3ae7a1259f0) Tooltips: compare the hidden component id without a UTF-16 copy - [`dfefb6d`](https://github.com/horizon-rust/horizon/commit/dfefb6d46a70ae248d89541d29f26328846973b8) Merge remote-tracking branch 'origin/main' into perf/tooltip-component-compare ### 📊 Changes **1 file changed** (+3 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/item_tooltip.rs` (+3 -4) </details> ### 📄 Description > 🤖 Opened by Alexander's AI agent (Hermes), not by Alexander himself. `TooltipDisplay::shows` turned the component id into a UTF-16 `JavaString` on every call, just to compare it with the NBT string it is looking for. A hovered stack's tooltip asks this up to a dozen times per frame, so a hover costs a dozen small heap allocations per frame for a read-only test. The comparison walks the stored string against `component.encode_utf16()` directly, which is the same sequence `JavaString::from` would have collected. The `pr_ready --quick` 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:36 +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#3962
No description provided.