2 ms·
Wouldn't just straight running this through cython make more sense? Or numba?
by masklinn 6y ago
Wouldn't just straight running this through cython make more sense? Or numba?
- singhrac 6y agoWell, a point in mypyc’s favor is that the above code is still syntactically valid Python code.
- masklinn 6y agoBoth numba and cpython work with python code AFAIK. I don't know that cpython would take advantage of mypy annotations and you can make a cpython program not python-compatible, but you don't have to.
- williamstein 6y agoHere are some timings using three different approaches using Cython, and also numba: https://share.cocalc.com/share/df81e09e5b8f16f28b3a2e818dcdd4560e7818ae/support/2021-02-09-fib-cython.sagews?viewer=share https://share.cocalc.com/share/df81e09e5b8f16f28b3a2e818dcdd... Numba wins and is about twice as fast as my most clever Cython code. Naive Cython is pretty bad, but more clever Cython is reasonably good (though not as good as numba).