Raxol.Terminal.Buffer.EnhancedManager (Raxol v0.5.0)
View SourceEnhanced buffer manager with advanced features for improved performance.
This module provides:
- Asynchronous buffer updates
- Buffer compression
- Buffer pooling
- Performance optimization
Features
- Async updates for non-blocking operations
- Compression to reduce memory usage
- Buffer pooling for efficient memory management
- Performance monitoring and optimization
Summary
Functions
Compresses the buffer to reduce memory usage.
Gets a buffer from the pool or creates a new one.
Gets the current performance metrics.
Creates a new enhanced buffer manager.
Optimizes the buffer manager based on current performance metrics.
Processes all queued updates.
Queues an asynchronous buffer update.
Returns a buffer to the pool.
Types
@type t() :: %Raxol.Terminal.Buffer.EnhancedManager{ buffer: Raxol.Terminal.ScreenBuffer.t(), compression_state: map(), performance_metrics: map(), pool: map(), update_queue: :queue.queue() }
Functions
Compresses the buffer to reduce memory usage.
Parameters
manager
- The buffer manager instanceopts
- Compression options
Returns
Updated buffer manager instance
@spec get_buffer(t(), non_neg_integer(), non_neg_integer()) :: {Raxol.Terminal.ScreenBuffer.t(), t()}
Gets a buffer from the pool or creates a new one.
Parameters
manager
- The buffer manager instancewidth
- The width of the bufferheight
- The height of the buffer
Returns
{buffer, updated_manager}
Gets the current performance metrics.
Parameters
manager
- The buffer manager instance
Returns
Map containing performance metrics
@spec new(non_neg_integer(), non_neg_integer(), keyword()) :: t()
Creates a new enhanced buffer manager.
Parameters
width
- The width of the bufferheight
- The height of the bufferopts
- Additional options
Returns
A new enhanced buffer manager instance
Optimizes the buffer manager based on current performance metrics.
Parameters
manager
- The buffer manager instance
Returns
Updated buffer manager instance
Processes all queued updates.
Parameters
manager
- The buffer manager instance
Returns
Updated buffer manager instance
@spec queue_update(t(), (Raxol.Terminal.ScreenBuffer.t() -> Raxol.Terminal.ScreenBuffer.t())) :: t()
Queues an asynchronous buffer update.
Parameters
manager
- The buffer manager instanceupdate_fn
- The function to execute for the update
Returns
Updated buffer manager instance
@spec return_buffer(t(), Raxol.Terminal.ScreenBuffer.t()) :: t()
Returns a buffer to the pool.
Parameters
manager
- The buffer manager instancebuffer
- The buffer to return
Returns
Updated buffer manager instance