Skip to content

Commit 88dc51a

Browse files
authored
Optimize mypy.fastparse (Python 3 only) (#5722)
This implements various small optimizations to make AST conversion from the typed_ast AST faster in compiled mypy. This makes compiled mypy about 4% faster on self-check, and it also makes non-compiled mypy around 1% faster on self-check. Notable included optimizations: * Implement visit methods more efficiently. Don't inherit visitors from typed_ast visitor classes. * Refactor decorated methods away, as they are slow with mypyc. * Refactor away many non-native attribute lookups. * Refactor away some nested functions as they are slow with mypyc. Also removed some dead code. I'll implement the same optimizations for Python 2 AST conversions in a separate PR.
1 parent 48d6057 commit 88dc51a

File tree

2 files changed

+291
-275
lines changed

2 files changed

+291
-275
lines changed

0 commit comments

Comments
 (0)