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%.

CaseWorkloadTime
examplesexamples/: 8 files, 12 models11.2 ms
bigone specification: 40 variables, 200 actions (1692 lines)48.2 ms
many241 files of examples copied 30 times374.5 ms
importpython -c 'import temporal_typing'42.0 ms
import-frontendpython -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% regression

Zero 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.