Raxol.Core.Performance.Caches.ComponentRenderCache (Raxol v2.0.1)
View SourceHigh-performance cache for component rendering results.
This module caches rendered component output to avoid repeated rendering of components with identical state and props. Components are frequently re-rendered during UI updates, and caching can significantly reduce computational overhead.
Features
- Caches component render results based on state+props hash
- Caches composed render trees
- Caches element-to-cell conversions
- Thread-safe concurrent access via ETS
- Telemetry instrumentation for monitoring
Performance Impact
Expected improvements:
- 50-70% reduction in component rendering overhead
- Sub-microsecond access for cached renders
- Significant reduction in CPU usage for static components
Summary
Functions
Estimates the render cost of a component to determine caching strategy.
Gets the composed render tree from cache or composes and caches it.
Gets the rendered cells for an element from cache or renders and caches them.
Gets the rendered element from cache or renders and caches it.
Gets the rendered output for a component from cache or renders and caches it.
Invalidates cache entries for a specific component.
Checks if a component render would benefit from caching. Returns true if the component is complex enough to warrant caching.
Warms up the cache with common component renders.
Functions
@spec estimate_render_cost(map()) :: :low | :medium | :high
Estimates the render cost of a component to determine caching strategy.
Gets the composed render tree from cache or composes and caches it.
Gets the rendered cells for an element from cache or renders and caches them.
Gets the rendered element from cache or renders and caches it.
Gets the rendered output for a component from cache or renders and caches it.
Invalidates cache entries for a specific component.
Checks if a component render would benefit from caching. Returns true if the component is complex enough to warrant caching.
Warms up the cache with common component renders.