Tooltips: compare the hidden component id without a UTF-16 copy
TooltipDisplay.shows built a JavaString from the id on every call just to test membership in the NBT list. A hovered tooltip asks this a dozen times per frame, so the hover allocated a dozen short vectors per frame for a read. Co-Authored-By: Hermes Agent (Nous Research) <noreply@nousresearch.com>
This commit is contained in:
@@ -56,10 +56,9 @@ impl<'a> TooltipDisplay<'a> {
|
||||
else {
|
||||
return true;
|
||||
};
|
||||
let component = horizon_world::nbt::JavaString::from(component);
|
||||
!hidden
|
||||
.iter()
|
||||
.any(|tag| matches!(tag, Tag::String(id) if id == &component))
|
||||
!hidden.iter().any(|tag| {
|
||||
matches!(tag, Tag::String(id) if id.0.iter().copied().eq(component.encode_utf16()))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user