High-performance TOON decoder using pure binary pattern matching.
Performance Design
- No NimbleParsec – direct binary pattern matching replaces parser combinator overhead
- No regex in hot paths – binary pattern matching replaces all regex in the decode loop
- Line-by-line processing – tail-recursive accumulators with
:lists.reverse/1 - Zero-copy slicing –
binary_part/3creates O(1) sub-binary references - Erlang BIFs –
:binary.split/3,:binary.match/2,:maps.from_list/1 - Compile-time inlining –
@compile {:inline, [...]}for all hot functions - Minimal allocations – tuple line info
{content, indent, is_blank}instead of maps - Fast-path splitting –
:binary.split/3when no quotes present; quote-aware fallback - Skip metadata – no MapSet/key_order tracking when
expand_pathsis off (default)