Repository navigation
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.pywith 37 scenarios
See CHANGELOG.md for full details.