mypy is slow when type checking torch
Open
Nobody has claimed this yet.
performance
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
λ mypy --version
mypy 1.11.2 (compiled: yes)
λ uv pip show torch
Using Python 3.11.8 environment at /Users/shantanu/.virtualenvs/openai-wfht
Name: torch
Version: 2.1.0
Location: /Users/shantanu/.virtualenvs/openai-wfht/lib/python3.11/site-packages
Requires: filelock, fsspec, jinja2, networkx, sympy, typing-extensions
Required-by: ...
λ time mypy -c 'import torch' --no-incremental
Success: no issues found in 1 source file
mypy -c 'import torch' --no-incremental 33.09s user 2.73s system 98% cpu 36.391 total
λ time mypy -c 'import torch'
Success: no issues found in 1 source file
mypy -c 'import torch' 6.24s user 0.88s system 95% cpu 7.454 total
We use a lot of torch at work, performance is probably the biggest reason folks at work switch to a different type checker.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The only entry point provided is mypy -c 'import torch', with and without --no-incremental, using mypy 1.11.2 and torch 2.1.0. Start by reproducing both timings; done means reducing the reported type-checking time while preserving the successful result and adding a regression check, though the issue names no source file or test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- devtools, performance
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100