fix: Replaces throttlers and packet callbacks with function pointers (#1063)

Replaces multi-cast delegates with function pointers to gain 25% in performance and lower allocations.
This commit is contained in:
Stefano Merotta 2022-06-15 21:48:43 +02:00 • committed by GitHub
parent b779d7737f
commit f24b98f8e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 189 additions and 172 deletions

View file

@ -19,12 +19,12 @@ namespace Server.Network;
public static class IncomingMobilePackets
{
public static void Configure()
public static unsafe void Configure()
{
IncomingPackets.Register(0x75, 35, true, RenameRequest);
IncomingPackets.Register(0x98, 0, true, MobileNameRequest);
IncomingPackets.Register(0xB8, 0, true, ProfileReq);
IncomingPackets.Register(0x6F, 0, true, SecureTrade);
IncomingPackets.Register(0x75, 35, true, &RenameRequest);
IncomingPackets.Register(0x98, 0, true, &MobileNameRequest);
IncomingPackets.Register(0xB8, 0, true, &ProfileReq);
IncomingPackets.Register(0x6F, 0, true, &SecureTrade);
}
public static void RenameRequest(NetState state, CircularBufferReader reader, int packetLength)