4 ms·
I know performance is not an explicit goal of Mypy, but I’ve been curious whether or not this project could lead to something much faster in the future (compile
by gonational 7y ago
I know performance is not an explicit goal of Mypy, but I’ve been curious whether or not this project could lead to something much faster in the future (compiled Mypy with Nim-like speed, something else?). Any thoughts?
Also, does anybody know of any benchmarks of typical programs in Mypy vs cPython?
- nimmer 7y ago"compiled Mypy with Nim-like speed" is Nim, essentially.
- dfee 7y agoThe types are ignored at runtime; they’re annotations. I guess they could still theoretically have some impact, but it should be negligible. Compiled mypy is a stated potential goal - but outside the scope of this project itself. Read more here: https://mypy.readthedocs.io/en/stable/faq.html#will-static-typing-make-my-programs-run-faster https://mypy.readthedocs.io/en/stable/faq.html#will-static-t...
- hsaliak 7y agoThere’s an experimental mypyc that can compile typed code to extensions, it’s not complete but it is used in mypy itself if I understand correctly. More practically, I’ve found that it’s much easier to translate well typed code to cython. It still requires work, and ymmv.
- anentropic 7y agoeventually there may be... https://github.com/python/mypy/tree/master/mypyc https://github.com/python/mypy/tree/master/mypyc
- hiccuphippo 7y agoI think cython is already using type annotations to compile python code.