Zstandard.Native.Runtimes
1.0.0
dotnet add package Zstandard.Native.Runtimes --version 1.0.0
NuGet\Install-Package Zstandard.Native.Runtimes -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Zstandard.Native.Runtimes" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Zstandard.Native.Runtimes" Version="1.0.0" />
<PackageReference Include="Zstandard.Native.Runtimes" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Zstandard.Native.Runtimes --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Zstandard.Native.Runtimes, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Zstandard.Native.Runtimes@1.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Zstandard.Native.Runtimes&version=1.0.0
#tool nuget:?package=Zstandard.Native.Runtimes&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Zstandard.Native
Ultra-fast Native AOT-safe Zstandard wrapper for .NET 8, .NET 9, and .NET 10 — zero-allocation Span<byte> APIs, source-generated [LibraryImport] P/Invoke, and hardware-accelerated buffer paths via AVX-512 / AVX10.2 and ARM64 SVE.
Install
dotnet add package Zstandard.Native
You also need a libzstd binary on the loader path. See Native runtime binaries for options (companion runtime package, bring-your-own, or system package manager).
Quick start
One-shot compress / decompress
using Zstandard.Native;
ReadOnlySpan<byte> src = File.ReadAllBytes("data.bin");
byte[] compressed = new byte[ZstdCompressor.GetCompressBound(src.Length)];
int n = ZstdCompressor.Compress(src, compressed, compressionLevel: 3);
byte[] back = new byte[src.Length];
ZstdCompressor.Decompress(compressed.AsSpan(0, n), back);
Streaming with context reuse
using var compressor = new ZstdStreamCompressor(compressionLevel: 3);
Span<byte> outBuf = stackalloc byte[ZstdStreamCompressor.RecommendedOutputSize];
foreach (var frame in frames)
{
compressor.Reset(); // reuses ZSTD_CCtx — no allocation
var r = compressor.Compress(frame.Span, outBuf, ZstdEndDirective.End);
sink.Write(outBuf[..r.BytesWritten]);
}
Features
- Zero allocations on the hot path —
Span<byte>-only public API - Native AOT compatible — every
IL2xxx/IL3xxxwarning is an error in CI; no reflection, no marshalling shims SafeHandlelifetime management forZSTD_CCtx/ZSTD_DCtx— finalizer-safe even on process abort- Streaming with
Reset()context reuse — skipsZSTD_createCCtxper frame - Hardware acceleration via
Vector512(AVX-512 / AVX10.2) and SVE (ARM64 variable-width) for buffer scrub operations - Targets libzstd ≥ 1.5.0 on
win-x64,win-arm64,linux-x64,linux-arm64,osx-x64,osx-arm64
Performance highlights
| Scenario | Runtime | Throughput | Allocated |
|---|---|---|---|
| Stream compress, context reuse, 1 MiB | NativeAOT 10.0 | 12 510 MB/s | 0 B |
| Stream compress, context reuse, 64 KB | NativeAOT 10.0 | 12 015 MB/s | 0 B |
| One-shot compress vs ZstdSharp, 64 KB level 3 | AOT 10.0 | +37% faster | 0 B vs 64 B |
| One-shot compress vs ZstdSharp, 1 MiB level 1 | AOT 10.0 | +37% faster | 0 B vs 65 B |
Links
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Zstandard.Native.linux-arm64 (>= 1.0.0)
- Zstandard.Native.linux-x64 (>= 1.0.0)
- Zstandard.Native.osx-arm64 (>= 1.0.0)
- Zstandard.Native.osx-x64 (>= 1.0.0)
- Zstandard.Native.win-arm64 (>= 1.0.0)
- Zstandard.Native.win-x64 (>= 1.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 43 | 5/30/2026 |
| 1.0.0-rc.1 | 45 | 5/26/2026 |
| 0.2.0-rc.2 | 32 | 5/26/2026 |
| 0.2.0-rc.1 | 41 | 5/26/2026 |