Raxol.Terminal.ANSI.CachedParser (Raxol Terminal v2.6.0)

Copy Markdown View Source

Optimized ANSI parser with caching for common sequences.

Reduces memory overhead and improves performance for frequently used escape sequences.

Summary

Functions

Benchmark comparison between cached and original parser.

Get statistics about cache coverage.

Parses ANSI escape sequences with caching optimization.

Types

parsed_token()

@type parsed_token() ::
  {:text, binary()}
  | {:csi, binary(), binary()}
  | {:osc, binary()}
  | {:dcs, binary()}
  | {:escape, binary()}

Functions

benchmark_comparison(input, iterations \\ 10000)

Benchmark comparison between cached and original parser.

cache_stats()

Get statistics about cache coverage.

parse(input)

@spec parse(binary()) :: [parsed_token()]

Parses ANSI escape sequences with caching optimization.

First checks if the input exactly matches a common cached sequence, then falls back to full parsing for complex inputs.