Skip to content

Commit caec3a1

Browse files
authored
roadmap: mypyc gate measured, passes (#5)
The typed-emit + mypyc experiment ran 2026-07-18 (hand-made --native mock-up of bench/expr_eval, mypyc 1.19 in a python:3.12 container): vs hand-written Python, emitted 4.25x -> match-free annotated rewrite interpreted 2.16x -> mypyc-compiled 1.26x, i.e. ~3.4x over today's output. Records the verdict and the class-pattern-match side finding in the Performance beyond CPython entry. Claude-Session: https://claude.ai/code/session_011PBhfjrzsUtwupYtJtzAWu
1 parent 972208b commit caec3a1

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

ROADMAP.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,19 @@ map_build 1.64× vs hand-written.
5959
(python/mypy#12362) and every Pyfun pattern match lowers to one, so native mode needs an alternate
6060
`if`/`elif` match lowering; nested closures (partial application), generators (`seq`), and
6161
`_pyfun_rt.py` all need a compatibility audit; and mypyc needs a C toolchain on the user's
62-
machine, so this is opt-in only — `pip install pyfun` stays toolchain-free. **Gate first:**
63-
hand-annotate one compute-bound example's emitted Python, run it through mypyc, measure (an
64-
afternoon). Build only if the multiple justifies an L.
62+
machine, so this is opt-in only — `pip install pyfun` stays toolchain-free. **Gate MEASURED
63+
2026-07-18** (hand-made `--native` mock-up of `bench/expr_eval` — annotations + `if`/`isinstance`
64+
match lowering + monomorphized fold; mypyc 1.19 in a python:3.12 container, gcc; artifacts in
65+
`local/mypyc-experiment/`): vs the hand-written baseline, emitted **4.25×** → rewrite-only
66+
(interpreted) **2.16×** → mypyc-compiled **1.26×**. Net: **~3.4× faster than today's emitted
67+
output** on the ADT-heavy workload, landing near hand-written speed — the L is justified on these
68+
numbers. Two riders: (1) roughly half the gap closed *before* compilation — CPython's
69+
class-pattern `match` dispatch is expensive (Windows 3.14 ablation: 2.31× → 1.44× from the
70+
rewrite alone), so the `if`/`isinstance` lowering mypyc forces is also a candidate lever on its
71+
own, though it trades away the readable `match`/`case` output the default emitter promises —
72+
native-mode-only unless a real workload demands otherwise; (2) frozen-dataclass ADTs compiled
73+
fine — mypyc's remaining headroom (native classes vs dataclasses, boxed union fields) is upside
74+
not yet claimed.
6575
- **Native backend** (not planned — recorded as a design-space note so the property it rests on
6676
stays deliberate) — the semantics are AOT-compilable: static HM types (no dynamic dispatch),
6777
default immutability (aggressive optimization is sound), tracked effects (pure code may be

0 commit comments

Comments
 (0)