Repository navigation
gdenticon v2.2.0
Highlights
v2.2.0 introduces format-specific raster backends and substantially improves image encoding performance, memory usage, and allocation behavior while preserving the existing public API and concurrent safety.
GIF encoding is over 100× faster in local benchmarks, while PNG, JPEG, BMP, and TIFF also receive significant improvements.
What's new
Format-specific raster backends
Raster rendering is now separated into shared geometry and specialized pixel backends:
- Paletted rendering for PNG and GIF
- RGBA rendering for JPEG
- Paletted rendering for opaque BMP and TIFF images
- NRGBA fallback for BMP and TIFF images containing alpha
- Shared grid geometry across all raster backends
The generation algorithm, identicon patterns, colors, and SVG output remain unchanged.
Encoding performance
Local 256×256 benchmarks on an Intel Core i5-14600KF:
| Format | Before | After | Improvement |
|---|---|---|---|
| GIF | 26.43 ms | 227.5 µs | ~116× faster |
| BMP | 482.7 µs | 39.91 µs | ~12.1× faster |
| TIFF | 426.3 µs | 51.55 µs | ~8.3× faster |
| PNG | 977.0 µs | 248.7 µs | ~3.9× faster |
| JPEG | 1.431 ms | 605.0 µs | ~2.4× faster |
Performance varies by platform, Go version, image size, and workload.
Reduced memory and allocations
- JPEG256 allocations reduced from 65,575 to 11 per operation
- GIF256 memory reduced from approximately 422 KB to 146 KB
- BMP256 memory reduced from approximately 264 KB to 67 KB
- TIFF256 memory reduced from approximately 265 KB to 74 KB
- PNG256 output reduced from 874 bytes to 160 bytes for the benchmark image
JPEG now uses the standard library's specialized RGBA path instead of performing a generic per-pixel conversion.
Transparency handling
- PNG preserves full palette alpha, including partial transparency
- GIF preserves binary transparency according to the GIF format
- BMP and TIFF use their optimized Paletted paths for opaque colors
- BMP and TIFF retain their NRGBA paths when either color contains alpha
Concurrency and correctness
- No shared mutable raster canvas
- No global worker pool or task queue
- Format-specific encoders remain safe for concurrent use with immutable icons and independent writers
- Added pixel-level tests for opaque, transparent, and partially transparent colors
- Added race tests for raster and encoding paths
- Added benchmarks for speed, memory, allocations, output size, and PNG parallel throughput
Compatibility
This release does not change the public Go API and has no known source-level breaking changes.
Encoded PNG, GIF, BMP, TIFF, and JPEG bytes may differ from previous versions because the optimized encoders use different pixel representations. Decoded image geometry and colors remain equivalent according to each format's capabilities.
Applications that cache or compare encoded files byte-for-byte should regenerate those artifacts after upgrading.
Installation
Using Go:
go install github.com/hourinX/gdenticon/v2/cmd/gdenticon@v2.2.0