Clast.Pcodec 0.1.1

dotnet add package Clast.Pcodec --version 0.1.1
                    
NuGet\Install-Package Clast.Pcodec -Version 0.1.1
                    
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="Clast.Pcodec" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Clast.Pcodec" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Clast.Pcodec" />
                    
Project file
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 Clast.Pcodec --version 0.1.1
                    
#r "nuget: Clast.Pcodec, 0.1.1"
                    
#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 Clast.Pcodec@0.1.1
                    
#: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=Clast.Pcodec&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Clast.Pcodec&version=0.1.1
                    
Install as a Cake Tool

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.
  • StreamingPcoReader<T> over ReadOnlySequence<byte>, PcoWriter<T> over IBufferWriter<byte>.
  • Wrapped formatPcoWrappedDecoder<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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.1.1 103 5/3/2026
0.1.0 93 5/3/2026