4 ms·
Cython basically lets you sprinkle types and performance into your Python code, as needed. It's not as drastic a departure as switching languages.
by auntienomen 8y ago
Cython basically lets you sprinkle types and performance into your Python code, as needed. It's not as drastic a departure as switching languages.
- ssivark 8y agoThere's a reason most high-performance Python libraries are not written that way, and core routines are just written in C instead. Proof of the pudding is in the eating! See this talk by Armin Ronacher (creator of Flask) on why the design of python makes it fundamentally unfriendly to performance optimizations: https://youtu.be/qCGofLIzX6g?t=171 https://youtu.be/qCGofLIzX6g?t=171 Julia has be designed ground up to avoid several such problems. See this discussion: https://discourse.julialang.org/t/julia-motivation-why-werent-numpy-scipy-numba-good-enough/2236 https://discourse.julialang.org/t/julia-motivation-why-weren... If your domain falls under the umbrella of numerical and scientific computing, writing Julia is as painless as writing python, with code that automatically runs roughly as fast as C. If you're used to writing numpy, you can hit the ground running in Julia, with maybe a few hours to become comfortable with the slightly different syntax and the names of useful libraries.
- jzwinck 8y ago> There's a reason most high-performance Python libraries are not written [with Cython], and core routines are just written in C instead. Pandas, Scipy and lxml are large, very popular Python libraries that use Cython. The article even mentions them at the end.
- auntienomen 8y agoThe point is that Cython provides a nice intermediate stage between C and CPython. Most optimizations need the first factor of 100, not the last factor of 2. You can usually achieve that in Cython with an effort measured in characters changed rather than lines of code changed. I've played with Julia. It's nice enough, but it doesn't offer me anything I don't already get through the C/Cython/CPython hierarchy.
- ChrisRackauckas 8y agoIt offers a ton that you don't get from Cython: http://www.stochasticlifestyle.com/why-numba-and-cython-are-not-substitutes-for-julia/ http://www.stochasticlifestyle.com/why-numba-and-cython-are-...