v0.14.5 - Performance Improvements
What's Changed
- Rename incorrect unit test file (test_ prefix indicates unit tests) by @Nexarian in #226
- Simple reliability improvements by @Nexarian in #240
- Add aggregation unit tests by @Nexarian in #241
- Update all Python versions to be consistent by @Nexarian in #243
- Add CSV endpoint tests to the proxy by @Nexarian in #244
- Add csv/v2 endpoint unit tests by @Nexarian in #245
- Bump version to 0.14.5 and proxy t86 optimizations by @jasonacox in #247
- Fix variable shadowing in
grid_status()method: renamedtypeparameter tooutput_typeto avoid shadowing Python's built-intype()function - Add backward compatibility for deprecated
typeparameter - still supported butoutput_typeis now preferred - Fix return type annotation for
extract_grid_status()method: changed fromstrtoOptional[str]to accurately reflect function can returnNone - Add age and expiration logging to TEDAPI Components cache for debugging consistency
- Proxy server build t86
- Fix variable shadowing in
Proxy t86 (20 Dec 2025)
- Performance Caching System:
- Added comprehensive performance caching layer for high-impact API routes
- Implemented
cached_route_handler()pattern for consistent cache management across endpoints - Added performance caching to:
/aggregates,/api/meters/aggregates,/vitals,/strings,/temps/pw,/alerts/pw,/freq,/pod,/json,/csv,/csv/v2endpoints - Shared cache optimization:
/aggregatesand/api/meters/aggregatesuse same cache key for identical payloads - Optimized
/csvand/jsonendpoints from 9 API calls to 6 calls (33% reduction) using aggregates consolidation - Eliminated 400-600ms overhead from redundant
get_components()fallback calls - Typical performance improvements: 99.6% faster cached responses (764ms → 2.9ms for
/aggregates) - Cache memory monitoring added to
/statsendpoint with detailed memory usage breakdown - Average overall response time improvement: 58% reduction (165.7ms → 70.2ms)
Performance Metrics Comparison:
| API Route | Before (ms) | After (ms) | Improvement | Usage Count | Impact Reduction |
|---|---|---|---|---|---|
/api/meters/aggregates |
821.5 | 151.3 | 81.6% ⚡ | 7,992 | 5,355 seconds saved |
/aggregates |
764.8 | 150.7 | 80.3% ⚡ | 3,880 | 2,383 seconds saved |
/strings |
545.7 | 37.3 | 93.2% ⚡ | 3,945 | 2,006 seconds saved |
/vitals |
339.3 | 33.9 | 90.0% ⚡ | 3,946 | 1,205 seconds saved |
/alerts/pw |
382.9 | 87.8 | 77.1% 🚀 | 3,881 | 1,145 seconds saved |
/temps/pw |
266.0 | 253.6 | 4.7% ✅ | 3,880 | 48 seconds saved |
Total Impact Reduction: ~12,142 seconds (3.4 hours) of response time saved per 8-hour period
-
Performance Testing Tool:
- Added
perf_test.pyscript for comprehensive API performance testing and analysis - Tests 27 production API routes with impact scoring (response_time × usage_frequency)
- Provides min/max/average response times with color-coded performance indicators
- Added
-
Bug Fixes:
- Fixed undefined variable
cache_ttl_secondserror in graceful degradation system - Fixed TypeError in
/csv/v2endpoint: removed invalidforce=Falseparameter fromlevel(),grid_status(), andget_reserve()calls - Fixed variable shadowing bug in
grid_status()method wheretypeparameter shadowed Python's built-intype()function - Renamed
typeparameter tooutput_typethroughout codebase for consistency and correctness
- Fixed undefined variable
-
Code Quality & Maintainability:
- Centralized cache logic in reusable helper functions for improved consistency
- Improved error handling and logging in
safe_pw_call()wrapper - Added unit tests for CSV endpoints (
TestCSVEndpointsclass with 7 test cases) - Enhanced error tracking with network error summaries and endpoint statistics
- Enhanced documentation with comprehensive performance testing guide
Full Changelog: v0.14.4...v0.14.5