feat: Replaces Zlib with LibDeflate (#1774)
> [!Warning] > Users on Linux/OSX will need to follow the Readme > and make sure `libdeflate` is properly installed > [!Note] > **Developer Note** > The API for compression has changed. Use `Deflate.Standard` for the same functionality. ### Summary * Replaces Zlib with LibDeflate for a 50% performance improvement! * Adds MacOS 14 to properly test Arm64
This commit is contained in:
parent
35a292d2c7
commit
1f701e7b55
11 changed files with 279 additions and 282 deletions
|
|
@ -3,6 +3,7 @@ using System.Buffers;
|
|||
using System.Collections.Generic;
|
||||
using System.IO.Compression;
|
||||
using System.Text;
|
||||
using Server.Compression;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
|
|
@ -165,14 +166,11 @@ namespace Server.Tests
|
|||
wantLength &= ~4095;
|
||||
|
||||
var packBuffer = ArrayPool<byte>.Shared.Rent(wantLength);
|
||||
var bytesPacked = Deflate.Standard.Pack(packBuffer, buffer.AsSpan(0, length));
|
||||
|
||||
var packLength = wantLength;
|
||||
|
||||
Zlib.Pack(packBuffer, ref packLength, buffer, length, ZlibQuality.Default);
|
||||
|
||||
Stream.Write(4 + packLength);
|
||||
Stream.Write(4 + bytesPacked);
|
||||
Stream.Write(length);
|
||||
Stream.Write(packBuffer, 0, packLength);
|
||||
Stream.Write(packBuffer, 0, bytesPacked);
|
||||
|
||||
ArrayPool<byte>.Shared.Return(packBuffer);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue