v1.2.5
What's New in v1.2.5
🚀 Major Performance Improvements
Zero-Allocation Terminal Writer
- Completely redesigned TerminalWriter with zero allocations during operation
- Performance improvements:
- Simple messages: 2x faster (203ns → 101ns)
- With fields: 4.1x faster (703ns → 171ns)
- Processes 7-8 million logs/second
✨ Key Changes
-
Pre-allocated Buffers
- Increased buffer size from 1KB to 2KB to handle complex logs without reallocation
- Reuses buffers across writes with mutex protection
-
Optimized String Operations
- Direct byte slice operations instead of string conversions
- Stack-based number formatting
- Inline field decoding
-
Pre-computed Lookup Tables
- Level strings and colors are pre-allocated
- Padding spaces pre-allocated
📊 Benchmark Results
BenchmarkTerminalWriterWithFields-10
Before: 203.7 ns/op 56 B/op 4 allocs/op
After: 101.1 ns/op 0 B/op 0 allocs/op
BenchmarkTerminalWriterManyFields-10
Before: 703.2 ns/op 120 B/op 14 allocs/op
After: 171.2 ns/op 0 B/op 0 allocs/op
🔧 Other Improvements
- Fixed NetBSD platform support
- Updated demo applications
- Maintained full API compatibility