Performance & Benchmarks
The shared front-end (temporal_typing.frontend) reads Python source with the standard library ast module without importing or executing user code, and completes in bounded time on any input.
Front-End Timings#
Measured with Python 3.14.2 on Darwin arm64. Each measurement is the best of several runs; make bench-check fails if any case regresses by more than 25%.
| Case | Workload | Time |
|---|---|---|
examples | examples/: 8 files, 12 models | 11.2 ms |
big | one specification: 40 variables, 200 actions (1692 lines) | 48.2 ms |
many | 241 files of examples copied 30 times | 374.5 ms |
import | python -c 'import temporal_typing' | 42.0 ms |
import-frontend | python -c 'import temporal_typing.frontend' | 52.4 ms |
Running Benchmarks Locally#
bash
make bench # re-measure and update docs/benchmark.md
make bench-check # fail on >25% regressionZero Runtime Cost#
Decorating a class with @spec records its clauses in a weak-key table (clauses_of(cls)) and returns the class untouched. Predicates are never evaluated at runtime: instantiating a class and calling its methods has identical cost to plain Python.