Skip to content

Patternia Performance - v0.8.0

Overview

v0.8.0 introduces a tiered variant dispatch model and related runtime/layout optimizations for large-branch workloads.


Core Algorithms

1. Tiered Variant Dispatch

Variant dispatch is selected by alternative count:

  • hot_inline for small alt counts
  • warm_segmented for medium alt counts
  • cold_compact for large alt counts

This reduces hot-path code pressure while preserving fast dispatch for common small/medium cases.

2. Compact Alt Map for Large Variant Sets

For large variant spaces, dispatch uses:

  • active_index -> compact slot map
  • miss -> fallback path
  • hit -> dense trampoline table

This avoids scanning irrelevant alternatives and keeps large dispatch data compact.

3. Per-Alt Case Range Narrowing (Typed Variant)

Typed variant dispatch computes case ranges per active alternative, then scans only the relevant range instead of the full case set.

4. Hot/Cold Path Separation

Large-branch dispatch work is moved into non-inline cold helpers to reduce instruction footprint in hot entry paths.


Implementation Pointers

  • include/ptn/core/common/optimize.hpp: dispatch tiers and metadata builders
  • include/ptn/core/common/eval.hpp: tier selection and runtime dispatch execution

Notes

  • This page records algorithm strategy for v0.8.0.
  • API-level changes are documented in: v0.8.0