Programming
ProgrammingIntermediate

ty 1.0 vs. Pyrefly vs. Zuban vs. Pyright vs. mypy: The Python Type Checker Benchmark

Hands-on benchmark of Astral’s ty 1.0, Meta’s Pyrefly, Zuban, Microsoft Pyright, and mypy on an 18,000-line typed Python codebase — wall time, Peak RSS memory, conformance trade-offs, plugins, and when to migrate.

Cover image: ty 1.0 vs. Pyrefly vs. Zuban vs. Pyright vs. mypy: The Python Type Checker Benchmark
Contents

For nearly a decade, Python developers had two choices for static type checking: wait for mypy (written in Python, accurate with plugins, painfully slow on large repositories) or run Pyright (written in TypeScript on Node.js, faster in VS Code via Pylance, but heavy on RAM in CI).

In December 2026, that duopoly officially ended. Astral (the team behind uv and Ruff) shipped ty 1.0, following Meta’s Pyrefly and David Halter’s Zuban into a full-blown Rust type-checker race for Python. Astral even disclosed production numbers from OpenAI showing a median 24x speedup and 73% lower peak memory across millions of lines of code.

ty 1.0 vs Pyrefly vs Zuban vs Pyright vs mypy bright 3D hero illustration showing sleek Rust prisms overtaking a heavy legacy monolith block

Instead of repeating release-note claims, we installed all five tools side by side — ty 1.0.0, pyrefly 1.5.1, zuban 0.11.1, mypy 2.4.1, and pyright 1.1.414 — and benchmarked them on an identical 201-file, 17,999-line typed Python codebase.

(Seeing the same Rust wave in JavaScript tooling? Compare Biome vs. ESLint and Prettier Benchmarks, or read Stop Passing Raw Dicts Around: Python Models for structuring typed Python code.)

The 5 Contenders: Rust Challengers vs. Legacy Giants

Before looking at milliseconds, here is how the five engines actually differ under the hood:

The 5 Contenders: Rust Challengers vs. Legacy Giants
Tool Maintainer Implementation Built-in LSP Killer Feature
ty 1.0 Astral (uv, Ruff) Rust Yes Set-theoretic & intersection types, uv/Ruff synergy, OpenAI-scale incremental engine
Pyrefly 1.5 Meta Rust Yes pyrefly infer for auto-annotating untyped repos, Meta-scale typing conformance
Zuban 0.11 David Halter (Jedi) Rust Yes Drop-in zmypy compatibility mode + lowest memory footprint in our test
Pyright 1.1 Microsoft (Pylance) TypeScript (Node.js) Yes Deep VS Code Pylance integration, strict typing defaults
mypy 2.4 Python / PSF ecosystem Python (mypyc) External (dmypy) Reference implementation + mature plugin ecosystem (django-stubs, SQLAlchemy)
Architecture comparison across ty 1.0, Pyrefly, Zuban, Pyright, and mypy: native multi-threaded Rust incremental graphs versus Node.js V8 and Python mypyc runtimes
Why Rust changed Python tooling: zero VM startup, multi-threaded incremental graphs, and a built-in LSP in one binary.

Real Benchmark: 201 Files, 17,999 Lines of Typed Python

We generated a 201-file Python repository (17,999 lines) using @dataclass(frozen=True), Generic[T], Protocol, TypedDict, async def, and chained cross-module imports (app/mod_000.py through app/mod_199.py). Every tool ran three cold passes (deleting .mypy_cache, .ruff_cache, and .pyrefly_cache between runs and passing --no-incremental to mypy) measured with /usr/bin/time -l on Apple Silicon macOS. You can reproduce the exact numbers locally using the benchmark repository on GitHub.

Cold type-checking benchmark results across 201 files and 17,999 lines: ty 1.0.0 finishes in 0.042 s at 74.9 MB RSS, Pyrefly in 0.075 s, Zuban in 0.102 s, mypy in 1.015 s, and Pyright in 3.148 s
Median of 3 cold runs on 17,999 lines of typed Python: ty 1.0.0 is 24.2x faster than mypy and 74.9x faster than Pyright.
Real Benchmark: 201 Files, 17,999 Lines of Typed Python
Tool & Version Median Wall Time 3 Cold Runs (s) Peak RSS (MB) Speedup vs. mypy
ty 1.0.0 0.042 s 0.051, 0.039, 0.042 74.9 MB 24.2x faster
pyrefly 1.5.1 0.075 s 0.089, 0.075, 0.075 96.1 MB 13.5x faster
zuban 0.11.1 0.102 s 0.099, 0.105, 0.102 64.2 MB 10.0x faster
mypy 2.4.1 1.015 s 1.699, 0.971, 1.015 149.9 MB 1.0x (baseline)
pyright 1.1.414 3.148 s 3.008, 3.148, 3.650 536.0 MB 0.32x

Three findings jump straight out of the numbers:

  1. 42 milliseconds changes developer habits. When a type check finishes in 0.042 s, you run it on every git pre-commit hook and every AI agent edit loop without noticing it exists. At 1–3+ seconds (and tens of seconds on 200k+ line monorepos), engineers disable checks locally and wait for CI.
  2. All three Rust engines stay under 100 MB. zuban 0.11.1 took the memory crown at 64.2 MB Peak RSS, followed by ty 1.0.0 (74.9 MB) and pyrefly 1.5.1 (96.1 MB). Meanwhile pyright pulled 536.0 MB because of its Node.js/V8 runtime overhead.
  3. Config defaults caught a real-world nuance. Without a pyproject.toml pinning pythonVersion, pyright 1.1.414 flagged T | None in app/core.py (Alternative syntax for unions requires Python 3.10 or newer), whereas ty, pyrefly, zuban, and mypy defaulted to modern Python 3.10+ semantics cleanly.

Speed is only half the story: running a Rust type checker in 42 ms turns static typing from a slow CI gate into an instant feedback loop for both IDE users and AI coding agents.

What Benchmarks Hide: Conformance, Plugins, and Trade-Offs

If speed were the only criterion, mypy and Pyright would be obsolete tomorrow. In real production repositories, three caveats still decide the winner:

  1. The Plugin Moat (mypy still wins here): If your backend relies heavily on django-stubs or custom mypy plugins that synthesize dynamic ORM attributes at check time, none of the Rust checkers match mypy’s plugin ecosystem yet.
  2. Typing Specification Conformance: Early betas of ty sat around ~53% on the official Python typing conformance suite, drawing fair criticism. By ty 1.0, Astral pushed conformance past ~97%, closing the gap with Pyrefly, Zuban, and Pyright while adding expressive intersection and set-theoretic types.
  3. Incremental IDE Responsiveness: In large monorepos, a cold CLI check is less important than how fast squiggly lines update after you edit one shared model. Because ty, Pyrefly, and Zuban ship native multi-threaded Rust LSP servers, IDE latency drops from seconds to single-digit milliseconds.

Practical Setup: Migrating Without Breaking Your IDE

Most blog posts skip the #1 annoyance when trying a Rust type checker in VS Code or Cursor: duplicate squiggly lines if Microsoft’s Pylance (Pyright) stays enabled alongside ty or Pyrefly.

  1. Disable duplicate type-checking in .vscode/settings.json:
    {
    "python.analysis.typeCheckingMode": "off",
    "python.languageServer": "None"
    }
    Then enable Astral’s official ty extension (or Meta’s Pyrefly extension) so only one LSP drives diagnostics and go-to-definition.
  2. Run ty in CI alongside mypy during migration:
    - name: Fast Rust type check (blocking)
    run: uvx ty check app/
    - name: Legacy plugin check (optional fallback)
    run: uvx mypy app/
    This gives developers 42 ms local feedback immediately while you verify django-stubs or custom plugin parity on a separate CI job.

Which Python Type Checker Should You Choose?

Decision matrix for choosing between ty 1.0, Pyrefly, Zuban, Pyright, and mypy based on codebase plugins, Astral stack, untyped legacy code, and VS Code workflows
Match the type checker to your codebase constraints: ty 1.0 for Astral stacks, Zuban for mypy migrations, Pyrefly for untyped repos, and mypy when plugins are mandatory.
  • Pick ty 1.0 if you already use uv and Ruff, want the fastest cold/incremental check (0.042 s in our test), and want one unified Astral toolchain without custom mypy plugins.
  • Pick Pyrefly if you are adopting types on a large legacy Python codebase and want pyrefly infer to bootstrap annotations automatically.
  • Pick Zuban if you have an existing mypy configuration and want a 10x faster, ultra-low-RAM (64.2 MB) drop-in migration path via zmypy.
  • Keep Pyright if your team lives inside VS Code + Pylance and relies on its exact diagnostic behavior.
  • Keep mypy (or run it in CI alongside ty locally) if your stack depends on django-stubs or third-party mypy plugins.

For greenfield Python services and AI-agent-driven repositories, ty 1.0 is the new default worth benchmarking first.

Frequently asked questions

How fast is Astral ty 1.0 compared to mypy and Pyright?

On our 201-file, 17,999-line typed Python benchmark (cold runs without cache under /usr/bin/time -l), ty 1.0.0 finished in a median of 0.042 s using 74.9 MB Peak RSS — 24.2x faster than mypy 2.4.1 (1.015 s, 149.9 MB) and 74.9x faster than Pyright 1.1.414 (3.148 s, 536.0 MB). Astral also reports a 24x median speedup and 73% lower peak memory at OpenAI across millions of lines of Python.

What is the difference between ty, Pyrefly, and Zuban?

All three are modern Rust-based Python type checkers with built-in Language Servers (LSP). ty 1.0 is built by Astral (creators of uv and Ruff) with set-theoretic/intersection types and fine-grained incremental analysis. Pyrefly is backed by Meta and excels at automated type annotation inference (pyrefly infer). Zuban is created by David Halter (author of Jedi) and offers the lowest Peak RSS (64.2 MB in our test) plus a zmypy mode for drop-in mypy config compatibility.

Can ty 1.0 replace mypy everywhere?

Not if your codebase depends on mypy-specific compiler plugins such as django-stubs or older SQLAlchemy plugin hooks. Early ty betas also trailed on typing specification conformance (~53%), though by 1.0 Astral closed the gap past ~97%. Test ty on a CI branch alongside mypy before switching.

Why did Pyright use 536 MB of RAM in the benchmark?

Pyright runs on Node.js (TypeScript) rather than a native compiled binary. That brings V8 runtime overhead and garbage collection memory (~536 MB Peak RSS on our 201-file run), compared to 64–96 MB for native Rust binaries like Zuban, ty, and Pyrefly.

ENDE