Raxol.Terminal.Scroll.Optimizer (Raxol v2.0.1)
View SourceHandles scroll optimization for better performance. Dynamically adjusts batch size based on recent scroll patterns and (optionally) performance metrics.
Summary
Types
@type scroll_event() :: %{ direction: :up | :down, lines: non_neg_integer(), timestamp: integer() }
@type t() :: %Raxol.Terminal.Scroll.Optimizer{ batch_size: non_neg_integer(), history: [scroll_event()], last_optimization: non_neg_integer() }
Functions
@spec new() :: t()
Creates a new optimizer instance.
@spec optimize(t(), :up | :down, non_neg_integer()) :: t()
Optimizes scroll operations for better performance.
- Increases batch size for large/rapid scrolls.
- Decreases batch size for small/precise or alternating scrolls.
- Uses recent scroll history to adapt.