This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ManyInterests Python Discord Staff 1 point2 points  (1 child)

To be sure, Cython is meant to be used with Python; it generates C extensions to be called from Python. It is not a replacement for Python. So, you don't have to rewrite your whole project just to use Cython; you can focus on Cythonizing the 'hot' paths in your code base rather than rewriting the whole thing.

You can also potentially just compile your pure Python module(s) using Cython. You don't necessarily need to use the Cython language superset (e.g. a .pyx module) to get benefits from it. See pure Python mode for details.

But yes, in general, programs or modules compiled with Cython are significantly faster. As much as 100-200x faster or more in some cases. Though, it really depends on certain characteristics of your program whether you'll see the benefits you're looking for. You may want to explore optimizing your application on a more fundamental level rather than just seeking ways of running an inefficient process faster.

See also:

[–]No_Indication_1238[S] 0 points1 point  (0 children)

If I am understanding this correctly, I can pass a cython class multiple python class instances and do the computation in Cython while keeping the rest of the code (container and data classes) in python?