Raxol.UI.RendererCached (Raxol v2.0.1)

View Source

Cached version of the UI Renderer that leverages component caching.

This module provides the same API as Raxol.UI.Renderer but uses aggressive caching to minimize redundant rendering operations.

Performance Benefits

  • 50-70% reduction in rendering time for static components
  • Automatic cache invalidation on prop/state changes
  • Batch rendering optimizations
  • Reduced CPU usage during animations and updates

Summary

Functions

Clears all rendering caches.

Gets cache statistics for monitoring.

Invalidates cache for specific component types. Use when component definitions change.

Renders a single element with caching.

Renders elements to cells using cache when possible.

Renders a component tree with intelligent caching. Recursively caches parent and child components.

Renders a virtual list with partial caching. Optimized for scrollable areas and long lists.

Warms up the cache with common components.

Functions

clear_cache()

Clears all rendering caches.

get_cache_stats()

Gets cache statistics for monitoring.

invalidate_component_type(type)

Invalidates cache for specific component types. Use when component definitions change.

render_element(element, theme, parent_style \\ %{})

Renders a single element with caching.

Drop-in replacement for Renderer.render_element/3

render_to_cells(element_or_elements, theme)

Renders elements to cells using cache when possible.

This is a drop-in replacement for Renderer.render_to_cells/2 that adds caching capabilities.

render_tree(root_element, theme)

Renders a component tree with intelligent caching. Recursively caches parent and child components.

render_virtual_list(items, viewport, theme, render_fn)

Renders a virtual list with partial caching. Optimized for scrollable areas and long lists.

warmup_cache()

Warms up the cache with common components.