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
|
|
@ -19,6 +19,7 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using Server.Buffers;
|
||||
using Server.Compression;
|
||||
|
||||
namespace Server;
|
||||
|
||||
|
|
@ -72,8 +73,8 @@ public static class MultiData
|
|||
}
|
||||
|
||||
var decompressedSize = entry.Size;
|
||||
if (Zlib.Unpack(compressionBuffer, ref decompressedSize, buffer, entry.CompressedSize) != ZlibError.Okay
|
||||
|| decompressedSize != entry.Size)
|
||||
if (Deflate.Standard.Unpack(compressionBuffer, buffer, out var bytesDecompressed) != LibDeflateResult.Success
|
||||
|| decompressedSize != bytesDecompressed)
|
||||
{
|
||||
throw new FileLoadException($"Error loading file {stream.Name}. Failed to unpack entry {i}.");
|
||||
}
|
||||
|
|
@ -118,11 +119,7 @@ public static class MultiData
|
|||
}
|
||||
|
||||
STArrayPool<byte>.Shared.Return(buffer);
|
||||
|
||||
if (compressionBuffer != null)
|
||||
{
|
||||
STArrayPool<byte>.Shared.Return(compressionBuffer);
|
||||
}
|
||||
STArrayPool<byte>.Shared.Return(compressionBuffer);
|
||||
}
|
||||
|
||||
private static void LoadMul(bool postHSMulFormat)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue