Clast.Pcodec
0.1.1
dotnet add package Clast.Pcodec --version 0.1.1
NuGet\Install-Package Clast.Pcodec -Version 0.1.1
<PackageReference Include="Clast.Pcodec" Version="0.1.1" />
<PackageVersion Include="Clast.Pcodec" Version="0.1.1" />
<PackageReference Include="Clast.Pcodec" />
paket add Clast.Pcodec --version 0.1.1
#r "nuget: Clast.Pcodec, 0.1.1"
#:package Clast.Pcodec@0.1.1
#addin nuget:?package=Clast.Pcodec&version=0.1.1
#tool nuget:?package=Clast.Pcodec&version=0.1.1
Clast.Pcodec
A .NET implementation of the Pco numeric compression format described by Mortenson et al. (2025). Wire-compatible with the reference pcodec/pcodec Rust crate, so files produced by either implementation can be read by the other.
Targets net10.0, net8.0, and netstandard2.0. Performance is the primary goal; the net10.0 build is the priority and uses SIMD where it makes sense, with slower scalar fallbacks on the older targets.
Status
Encoder and decoder feature-parity with the Rust reference for the wrapped/standalone v4.1 format:
- Modes — Classic, IntMult, FloatMult, FloatQuant (Dict on the decode side).
- Delta encoding — NoOp, Consecutive, Lookback, Conv1.
- Auto-pick — per-chunk brute-force across detected mode candidates and all delta variants.
- Streaming —
PcoReader<T>overReadOnlySequence<byte>,PcoWriter<T>overIBufferWriter<byte>. - Wrapped format —
PcoWrappedDecoder<T>/PcoWrappedEncoder<T>for hosts that manage chunk/page framing themselves (Vortex, parquet's pco extension, etc.). - Multi-chunk — transparent for inputs above the per-chunk format limit.
- Cross-validated — every encoder feature is tested by encoding through Clast.Pcodec and decoding through the Rust reference binary.
Quick start
using Clast.Pcodec;
// One-shot
byte[] encoded = Pco.Compress(values); // auto mode/delta selection
double[] decoded = Pco.Decompress<double>(encoded);
// Streaming (no T[] allocation, pipelines-friendly)
using var writer = new PcoWriter<double>(bufferWriter);
writer.Write(batch1);
writer.Write(batch2);
writer.Dispose(); // flushes remaining + emits format terminator
using var reader = new PcoReader<double>(memory);
Span<double> dst = stackalloc double[256];
while (reader.ReadBatch(dst) is var n && n > 0)
Process(dst.Slice(0, n));
// Wrapped format (host manages framing — Vortex, parquet, ClickHouse)
var encoder = new PcoWrappedEncoder<double>();
ReadOnlySpan<byte> header = encoder.Header; // 1–2 bytes; persist alongside the array
WrappedChunkBytes wrapped = encoder.EncodeChunk(values);
// wrapped.ChunkMeta — store once per chunk
// wrapped.Page — store once per page (1 page per chunk in this encoder)
var decoder = new PcoWrappedDecoder<double>(header);
ChunkHandle chunk = decoder.BeginChunk(wrapped.ChunkMeta);
double[] dst = new double[pageElementCount];
decoder.DecodePage(chunk, wrapped.Page, pageElementCount, dst);
Layout
src/Pcodec Clast.Pcodec library
tests/Pcodec.Tests xUnit tests (multi-targeted: net10.0 + net472)
bench/Pcodec.Bench BenchmarkDotNet harness
License
Apache-2.0. See LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- System.Memory (>= 4.5.5)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.