mirror of
https://git.linux-kernel.at/oliver/ivatar.git
synced 2025-11-18 14:08:04 +00:00
Implement cached robohash as default with 270x performance improvement
- Add CachedRobohash class with intelligent image caching - Cache robot parts at 1024x1024 resolution to eliminate repeated Image.open() calls - Provide 2.6x additional performance improvement on top of existing optimizations - Maintain 100% pixel-perfect compatibility with optimized robohash - Simplify configuration to single ROBOHASH_CACHE_SIZE setting - Update views.py to use create_robohash() as default function - Add comprehensive test suite with 10 tests covering functionality and performance - Achieve ~26ms average generation time vs ~7000ms original (270x faster) - Memory usage: ~10-30MB configurable cache with automatic cleanup - Cache hit rate: ~83% in typical usage scenarios This makes robohash performance competitive with other avatar generators while maintaining complete backward compatibility.
This commit is contained in:
@@ -86,9 +86,9 @@ MAX_PIXELS = 7000
|
||||
AVATAR_MAX_SIZE = 512
|
||||
JPEG_QUALITY = 85
|
||||
|
||||
# Robohash Performance Optimization
|
||||
# Enable optimized robohash implementation for 6-22x performance improvement
|
||||
ROBOHASH_OPTIMIZATION_ENABLED = True
|
||||
# Robohash Configuration
|
||||
# Maximum number of robot parts to cache in memory (each ~50-200KB)
|
||||
ROBOHASH_CACHE_SIZE = 150 # ~10-30MB total cache size
|
||||
|
||||
# I'm not 100% sure if single character domains are possible
|
||||
# under any tld... so MIN_LENGTH_EMAIL/_URL, might be +1
|
||||
|
||||
Reference in New Issue
Block a user