v2.0.0 - Major Performance Overhaul
Release v2.0.0
π Major Performance Overhaul
This release represents a complete performance rewrite leveraging Go 1.23+ features to achieve unprecedented speed and true zero allocations.
β‘ Performance Highlights
- 2x faster than v1.x - Reduced from ~40 ns/op to 21.88 ns/op
- True zero allocations - Direct writer operations now have 0 B/op
- 45.7 million logs/second - Industry-leading throughput
- Removed 64MB upfront allocation - More memory efficient
π Breaking Changes
- Removed redundant logger implementations:
NanoLogger- UseUltimateLoggerinsteadSimpleLogger- UseLoggerinsteadZeroAllocLogger- UseUltimateLoggerinstead
- Changed internal buffer pool implementation
- Minimum Go version is now 1.23
β¨ New Features
Generic Buffer Pool
- Type-safe buffer management with zero interface{} boxing
- Tiered allocation strategy (64B to 1MB+)
- Automatic size class detection
Zero-Copy String Operations
StringToBytes()- Convert strings without allocationBytesToString()- Convert bytes without allocation- Uses
unsafe.StringDatafrom Go 1.20+
Lock-Free Async Writer
- Generic ring buffer with
atomic.Pointer[T] - Multiple worker goroutines for parallel writes
- Reduced allocations from 542 B/op to 262 B/op
Windows Color Support
- Automatic ANSI color detection for Windows 10+
- Virtual terminal processing enablement
NO_COLORenvironment variable support- Manual color control via
SetColorEnabled()
π Bug Fixes
- Fixed terminal writer magic header mismatch
- Fixed buffer allocation issues for large messages
- Fixed string escaping performance with loop unrolling
- Fixed Windows terminal color escape sequences
π Benchmark Improvements
BenchmarkUltimateLogger-10 56M 21.88 ns/op 0 B/op 0 allocs/op
BenchmarkAsyncWriterDirect-10 8M 158.0 ns/op 0 B/op 0 allocs/op
BenchmarkZeroCopyString-10 2000M 0.497 ns/op 0 B/op 0 allocs/op
π§ Migration Guide
For NanoLogger users:
// Old
logger := zlog.NewNanoLogger()
// New
logger := zlog.NewUltimateLogger()For Windows users seeing escape codes:
// Option 1: Disable colors
tw := zlog.NewTerminalWriter(os.Stdout).(*zlog.TerminalWriter)
tw.SetColorEnabled(false)
logger.SetWriter(tw)
// Option 2: Use plain writer
logger.SetWriter(zlog.StdoutWriter())
// Option 3: Set environment variable
// SET NO_COLOR=1Full changelog: v1.2.5...v2.0.0