Skip to content

v0.4.18

Latest

Choose a tag to compare

@B4PT0R B4PT0R released this 10 Apr 07:19
· 1 commit to main since this release

Performance overhaul for TypeChecker & Coercer

Major optimization of the type checking and coercion pipeline — the primary bottleneck of the package.

Highlights

  • check_type(int, 42): -61% (0.54 → 0.21 us/op)
  • check_type cached nested generic: -51% (36.94 → 17.98 us/op)
  • coerce cached nested generic: -45% (72.03 → 39.71 us/op)
  • modict init (cached): -30% (259.65 → 182.02 us/op)
  • typed assignment / no-op: -44% (10.56 → 5.88 us/op)
  • bulk update / no-op values: -47% (31.59 → 16.68 us/op)

What changed

  • Fast-path checks reordered by realistic type frequency (int/str/float first)
  • Eliminated redundant double fast-path calls in the check_type pipeline
  • Rare hint wrappers (TypeAlias, ForwardRef, Required/NotRequired) integrated into cached hint plan
  • Inline element checking for common types in sequences/sets/mappings
  • Coercer fast-path bypass for already-matching basic types
  • New benchmarks/typechecker_validation.py with 37 scenarios

See CHANGELOG.md for full details.