Raxol.UI.Rendering.RenderBatcher (Raxol v2.0.1)

View Source

Batches multiple render requests within animation frames to optimize performance. Coalesces rapid UI updates into single render operations.

Features

  • Frame-based batching (16ms default)
  • Priority-based processing
  • Damage accumulation
  • Adaptive batching based on complexity

Summary

Functions

Performs batch rendering of a buffer with optimizations. This is a convenience function for benchmarking.

Returns a specification to start this module under a supervisor.

Forces an immediate flush of all pending updates. Used for high-priority updates that can't wait for next frame.

Gets current batching statistics.

Updates the frame interval for adaptive batching.

Submits a render update to the batcher. Updates are accumulated until the next frame flush.

Functions

batch_render(buffer, opts \\ [])

@spec batch_render(buffer :: term(), opts :: keyword()) :: {:ok, term()}

Performs batch rendering of a buffer with optimizations. This is a convenience function for benchmarking.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

default_frame_interval_ms()

force_flush(batcher \\ __MODULE__)

@spec force_flush(pid() | atom()) :: :ok

Forces an immediate flush of all pending updates. Used for high-priority updates that can't wait for next frame.

get_stats(batcher \\ __MODULE__)

@spec get_stats(pid() | atom()) :: map()

Gets current batching statistics.

set_frame_interval(interval_ms, batcher \\ __MODULE__)

@spec set_frame_interval(pos_integer(), pid() | atom()) :: :ok

Updates the frame interval for adaptive batching.

start_link(init_opts \\ [])

submit_update(tree, diff_result, priority \\ :medium, batcher \\ __MODULE__)

@spec submit_update(
  tree :: map(),
  diff_result :: term(),
  priority :: :low | :medium | :high,
  pid() | atom()
) :: :ok

Submits a render update to the batcher. Updates are accumulated until the next frame flush.