Releases: DevAM-Tools/ZeroAlloc
Releases · DevAM-Tools/ZeroAlloc
0.1.3
0.1.3
Add odd-length HexWrappers & improve recursive detection
Features
- Hex Wrappers: Add
Hex1,Hex3,Hex5,Hex6,Hex7for odd bit-length valuesHex1: 4-bit nibble (0-F)Hex3: 12-bit values (000-FFF)Hex5: 20-bit values (00000-FFFFF)Hex6: 24-bit values like RGB colors (000000-FFFFFF)Hex7: 28-bit values (0000000-FFFFFFF)
Improvements
- Generator: Improve
MayUseZeroAllocInternallydetection- Analyze TryFormat method body for actual ZeroAlloc API calls
- Check for ZeroAllocBase inheritance instead of broad assembly reference check
- Reduces false positive ZA1002 warnings for types that don't use ZeroAlloc
Internal
- Cleanup: Use
Encoding.UTF8instead ofSystem.Text.Encoding.UTF8in FormattedWrappers - Version bump to 0.1.3 for both ZeroAlloc and ZeroAlloc.Generator
0.1.2
0.1.2
Fix nuget package issue and make ZeroAlloc containing the generator
0.1.1
Fix Generator nuget configuration
0.1.0
Summary
This is the first public release of ZeroAlloc, a zero-allocation serialization library for .NET 10+ that uses Roslyn source generators to create optimized, type-specific formatting and parsing code at compile time.
✨ Features
Core Library (ZeroAlloc)
- Zero-allocation string formatting via
ZA.String()with compile-time generated code - Zero-allocation UTF-8 generation via
ZA.Utf8() - Culture-sensitive variants via
ZA.LocalizedString()andZA.LocalizedUtf8() - Zero-allocation binary serialization via
ZA.Bytes() - Generated binary parsing via
ZA.ParseBytes<T>()and[BinaryParsable]attribute - Manual builders for advanced scenarios:
TempStringBuilder/SpanStringBuilderfor string buildingTempBytesBuilder/SpanBytesBuilderfor byte building
- Endian-aware type wrappers:
U16BE,U32LE,I64BE,F32LE, etc. - VarInt encoding:
VarInt7,VarInt14,VarInt21,VarInt28 - String encodings:
Utf8,Ascii, length-prefixed variants (Utf8L8,Utf8L16BE, etc.) - Hex formatting wrappers:
HexU8,HexU16,HexU32,HexU64,HexBytes - Bit-level parsing via
BitReaderfor sub-byte field extraction - Configurable buffer sizes (default 2 MiB per thread, compile-time or runtime adjustable)
Source Generator (ZeroAlloc.Generator)
- Roslyn incremental source generator targeting
netstandard2.0 - Generates optimized
ZA.String(),ZA.Utf8(),ZA.Bytes()overloads at compile time - Generates
TryParse()/Parse()methods for[BinaryParsable]structs - 17 analyzer diagnostics (ZA0001–ZA2013) for compile-time validation:
- Class structure checks (partial, internal)
- Argument type validation
- Binary parsing attribute consistency
- Length field ordering and alignment checks
📦 Project Structure
| Project | Description |
|---|---|
ZeroAlloc |
Core library (net10.0) |
ZeroAlloc.Generator |
Roslyn source generator (netstandard2.0) |
ZeroAlloc.Tests |
xUnit test suite with >50 test classes |
ZeroAlloc.Benchmarks |
BenchmarkDotNet performance tests |
ZeroAlloc.Demo |
Demo/example application |
🔧 Build & Packaging
- Solution file:
ZeroAlloc.slnx - VS Code tasks for build, test, pack, clean
- NuGet packages auto-generated on Release build:
ZeroAlloc.0.1.0.nupkg+.snupkgZeroAlloc.Generator.0.1.0.nupkg+.snupkg
- Deterministic builds with source-link support
- MIT License
📝 Files Changed
- 59 files changed, ~29,800 insertions
- Complete library implementation
- Comprehensive test coverage
- Full documentation in README.md
- VS Code workspace configuration
- NuGet packaging configuration
🎯 Target Scenarios
- Network protocol serialization (CAN, FlexRay, custom binary protocols)
- High-performance logging without allocations
- Embedded systems with memory constraints
- Game development with GC-sensitive code paths
- Any scenario requiring predictable, allocation-free serialization