ModernUO/Projects/Server.Tests/Tests/Network/Packets/Outgoing
Kamron Batman 5f9fa88220
perf: Zero-alloc interpolation for SendMessage/Overhead APIs (#2434)
## Summary

Phase 1 of a multi-phase optimization to eliminate intermediate string allocations between `$"..."` interpolation and the packet text region for ModernUO's player-facing message APIs.

- Adds `[InterpolatedStringHandler]` overloads to every `Send*`/`Public/Local/Private/NonlocalOverheadMessage`/`Say`/`Emote`/`Whisper`/`Yell`/`SendLocalizedMessageTo` API in `OutgoingMessagePackets`, `Mobile`, and `Item`. Each overload is a 3-line shim that forwards `handler.Text` to the existing span-based path then calls `handler.Clear()` to return the rented `STArrayPool<char>` buffer (matches the established `SpanWriter.WriteAscii(ref RawInterpolatedStringHandler)` precedent).
- Converts `string text/args/affix/name` parameters to `ReadOnlySpan<char>` for consistency with the handler path. `lang` intentionally stays `string` (it's never interpolated and the `??= "ENU"` fallback stays cleaner).
- Adds `int charCount` overloads of the three `GetMaxMessage*Length` helpers so stackalloc sizing can avoid the redundant `ROS<char>` round-trip.
- Moves `Mobile` (17 methods) and `Item` (4 methods) message methods into new partial-class files (`Mobile.Messages.cs`, `Item.Messages.cs`) for organization.

No UOContent call sites change in this PR — existing `string`/`ROS<char>` calls compile unchanged via implicit conversion. Phase 2 (intermediate-string audit) and Phase 3 (cleanup PRs) follow.

## Files

- `Projects/Server/Network/Packets/OutgoingMessagePackets.cs` — `string` → `ROS<char>` for text params, `int charCount` length helpers added, class made `partial`
- `Projects/Server/Network/Packets/OutgoingMessagePackets.Interpolated.cs` (new) — 3 `ref RawInterpolatedStringHandler` extension overloads
- `Projects/Server/Mobiles/Mobile.cs` — message methods extracted (-262 lines)
- `Projects/Server/Mobiles/Mobile.Messages.cs` (new, 463 lines) — moved + ROS-converted methods + 25 handler overloads
- `Projects/Server/Items/Item.cs` — message methods extracted (-93 lines)
- `Projects/Server/Items/Item.Messages.cs` (new, 142 lines) — moved + ROS-converted methods + 4 handler overloads
- `Projects/Server.Tests/Tests/Network/Packets/Outgoing/MessagePacketTests.cs` — 3 new regression tests verifying byte-equivalence for the handler overloads
2026-05-03 18:04:02 -07:00
..
AccountPackets.cs fix: Exempts localhost from IPLimiter. Preps testing for io_uring (#2316) 2026-01-20 08:54:15 -08:00
AccountPacketTests.cs feat: Upgrades networking to use io_uring. (#2315) 2026-02-01 16:02:32 -08:00
AttributeNormalizer.cs fix: Exempts localhost from IPLimiter. Preps testing for io_uring (#2316) 2026-01-20 08:54:15 -08:00
CombatPackets.cs fix: Exempts localhost from IPLimiter. Preps testing for io_uring (#2316) 2026-01-20 08:54:15 -08:00
CombatPacketTests.cs feat: Upgrades networking to use io_uring. (#2315) 2026-02-01 16:02:32 -08:00
ContainerPackets.cs fix: Exempts localhost from IPLimiter. Preps testing for io_uring (#2316) 2026-01-20 08:54:15 -08:00
ContainerPacketTests.cs feat: Upgrades networking to use io_uring. (#2315) 2026-02-01 16:02:32 -08:00
DamagePackets.cs fix: Exempts localhost from IPLimiter. Preps testing for io_uring (#2316) 2026-01-20 08:54:15 -08:00
DamagePacketTests.cs feat: Upgrades networking to use io_uring. (#2315) 2026-02-01 16:02:32 -08:00
EffectPackets.cs fix: Exempts localhost from IPLimiter. Preps testing for io_uring (#2316) 2026-01-20 08:54:15 -08:00
EffectPacketTests.cs feat: Upgrades networking to use io_uring. (#2315) 2026-02-01 16:02:32 -08:00
EquipmentPackets.cs fix: Exempts localhost from IPLimiter. Preps testing for io_uring (#2316) 2026-01-20 08:54:15 -08:00
EquipmentPacketTests.cs feat: Upgrades networking to use io_uring. (#2315) 2026-02-01 16:02:32 -08:00
GumpPackets.cs fix: Exempts localhost from IPLimiter. Preps testing for io_uring (#2316) 2026-01-20 08:54:15 -08:00
GumpPacketTests.cs feat: Upgrades networking to use io_uring. (#2315) 2026-02-01 16:02:32 -08:00
ItemPackets.cs fix: Exempts localhost from IPLimiter. Preps testing for io_uring (#2316) 2026-01-20 08:54:15 -08:00
ItemPacketTests.cs feat: Upgrades networking to use io_uring. (#2315) 2026-02-01 16:02:32 -08:00
LightPackets.cs fix: Exempts localhost from IPLimiter. Preps testing for io_uring (#2316) 2026-01-20 08:54:15 -08:00
LightPacketTests.cs feat: Upgrades networking to use io_uring. (#2315) 2026-02-01 16:02:32 -08:00
MapPackets.cs fix: Exempts localhost from IPLimiter. Preps testing for io_uring (#2316) 2026-01-20 08:54:15 -08:00
MapPacketTests.cs feat: Upgrades networking to use io_uring. (#2315) 2026-02-01 16:02:32 -08:00
MenuPackets.cs fix: Exempts localhost from IPLimiter. Preps testing for io_uring (#2316) 2026-01-20 08:54:15 -08:00
MenuPacketTests.cs feat: Upgrades networking to use io_uring. (#2315) 2026-02-01 16:02:32 -08:00
MessagePackets.cs fix: Exempts localhost from IPLimiter. Preps testing for io_uring (#2316) 2026-01-20 08:54:15 -08:00
MessagePacketTests.cs perf: Zero-alloc interpolation for SendMessage/Overhead APIs (#2434) 2026-05-03 18:04:02 -07:00
MobilePackets.cs fix: Exempts localhost from IPLimiter. Preps testing for io_uring (#2316) 2026-01-20 08:54:15 -08:00
MobilePacketTests.cs feat: Upgrades networking to use io_uring. (#2315) 2026-02-01 16:02:32 -08:00
MovementPackets.cs fix: Exempts localhost from IPLimiter. Preps testing for io_uring (#2316) 2026-01-20 08:54:15 -08:00
MovementPacketTests.cs feat: Upgrades networking to use io_uring. (#2315) 2026-02-01 16:02:32 -08:00
PlayerPackets.cs fix: Exempts localhost from IPLimiter. Preps testing for io_uring (#2316) 2026-01-20 08:54:15 -08:00
PlayerPacketTests.cs feat: Upgrades networking to use io_uring. (#2315) 2026-02-01 16:02:32 -08:00
SecureTradePackets.cs fix: Exempts localhost from IPLimiter. Preps testing for io_uring (#2316) 2026-01-20 08:54:15 -08:00
SecureTradePacketTests.cs feat: Upgrades networking to use io_uring. (#2315) 2026-02-01 16:02:32 -08:00
TargetPackets.cs fix: Exempts localhost from IPLimiter. Preps testing for io_uring (#2316) 2026-01-20 08:54:15 -08:00
TargetPacketsTests.cs feat: Upgrades networking to use io_uring. (#2315) 2026-02-01 16:02:32 -08:00
VendorBuyPackets.cs fix: Exempts localhost from IPLimiter. Preps testing for io_uring (#2316) 2026-01-20 08:54:15 -08:00
VendorBuyPacketTests.cs feat: Upgrades networking to use io_uring. (#2315) 2026-02-01 16:02:32 -08:00
VendorSellPackets.cs feat: Adds robust speed hack detection and movement throttling (#2266) 2026-03-07 11:44:37 -08:00
VendorSellPacketTests.cs feat: Upgrades networking to use io_uring. (#2315) 2026-02-01 16:02:32 -08:00
VirtualHairPackets.cs fix: Exempts localhost from IPLimiter. Preps testing for io_uring (#2316) 2026-01-20 08:54:15 -08:00
VirtualHairPacketTests.cs feat: Upgrades networking to use io_uring. (#2315) 2026-02-01 16:02:32 -08:00