Closed tal7aouy closed 9 months ago
This PR adds caching to get_encoding to avoid repeatedly constructing Encodings.
Significant speedups when requesting the same encodings multiple times
Simple change with minimal code changes
Fully backwards compatible
Add max cache size to bound memory usage
Support cache keying off config instead of just name
Overall this simple change provides large performance improvements by caching encoding objects.
Please let me know if any changes are needed!
There is already caching
Summary
This PR adds caching to get_encoding to avoid repeatedly constructing Encodings.
Implementation
Benefits
Significant speedups when requesting the same encodings multiple times
Simple change with minimal code changes
Fully backwards compatible
Future Improvements
Add max cache size to bound memory usage
Support cache keying off config instead of just name
Overall this simple change provides large performance improvements by caching encoding objects.
Please let me know if any changes are needed!