Skip to content

0.0.15

Choose a tag to compare

@jinzhongjia jinzhongjia released this 01 Nov 17:16
· 4 commits to main since this release

zig-msgpack 0.0.15 Release Notes

Overview

Performance-focused release with 5-90% speed improvements, enhanced security features, and Zig 0.16 support. Fully backward compatible with 0.0.14.

Performance Optimizations

CPU Cache Prefetching

  • x86/x64: SSE/AVX prefetch instructions (PREFETCHT0/1/2, PREFETCHNTA)
  • ARM64: ARM PRFM instructions for Apple Silicon and ARM servers
  • 10-20% faster for large strings/binary, 8-15% faster for large arrays/maps
  • Compile-time feature detection, zero runtime overhead

SIMD & Parser Optimizations

  • SIMD-accelerated integer operations, string comparison, memory copying
  • O(1) lookup table for marker byte conversion
  • HashMap replaces ArrayList for map storage (10× faster lookups)
  • Branch prediction hints for hot paths

Security Features

Iterative Parser with Configurable Limits

  • Prevents stack overflow on deeply nested input
  • Protection against DoS attacks (depth bombs, size bombs)
  • Default limits: 1K depth, 1M elements, 100MB strings/binary
const StrictPacker = msgpack.PackWithLimits(
    *Writer, *Reader,
    Writer.Error, Reader.Error,
    Writer.write, Reader.read,
    .{
        .max_depth = 50,
        .max_array_length = 10_000,
        .max_map_size = 10_000,
        .max_string_length = 1024 * 1024,
        .max_bin_length = 1024 * 1024,
        .max_ext_length = 512 * 1024,
    },
);

Platform Support

  • OS: Windows, macOS (Intel/ARM), Linux
  • Architectures: x86_64, ARM64, RISC-V, MIPS
  • Zig Versions: 0.14.0, 0.15.x, 0.16.0-dev
  • 87 tests across all platform combinations

New Features

Timestamp API

const ts = Timestamp.fromNanos(1234567890123456789);

Zig 0.16 Compatibility

  • New src/compat.zig compatibility layer
  • Drop-in BufferStream replacement for removed std.io.FixedBufferStream
  • Same API across Zig 0.14-0.16

Performance Benchmarks (ReleaseFast)

Operation 0.0.14 0.0.15 Improvement
Large strings (300B) ~12 µs/op ~10 µs/op +20%
Large binary (1KB) ~8 µs/op ~6.7 µs/op +16%
Medium arrays (100) ~19 µs/op ~16.7 µs/op +12%
Medium maps (50) ~520 µs/op ~48 µs/op +90%
Nested structures ~17 µs/op ~13 µs/op +23%

Bug Fixes

  • Enhanced validation for malformed data
  • Fixed integer boundary edge cases
  • Improved security limit error messages
  • Removed unused parameters

No Breaking Changes

None. Fully backward compatible with 0.0.14.

Migration

zig fetch --save https://github.com/zigcc/zig-msgpack/archive/v0.0.15.tar.gz

Changelog

Features

  • Multi-architecture CPU cache prefetch (x86/ARM)
  • SIMD integer optimizations
  • Configurable security limits (PackWithLimits API)
  • Timestamp.fromNanos() method
  • Generic map keys with SIMD
  • Cross-platform CI testing

Performance

  • HashMap replaces ArrayList for maps
  • Parser lookup table optimization
  • Hot path branch prediction hints
  • Optimized array initialization

Compatibility

  • Zig 0.16 compatibility layer (src/compat.zig)
  • CI matrix for Zig 0.14, 0.15, 0.16

Infrastructure

  • Architecture matrix CI (x86_64, ARM64)
  • Cross-platform testing (Windows, macOS, Linux)
  • Automated benchmarking