[Cython] Vs [Python] ?

Attractive Contrast ?

Mission : Which one is Faster ?

  • Comparing of Execution runtime for [Selection_sort] with Time Complexity: O(n2) in Cython and Python .

PYTHON :

Python is an interpreted high-level general-purpose programming language. Its design philosophy emphasizes code readability with its use of significant indentation. Its language constructs as well as its object-oriented approach aim to help programmers write clear, logical code for small and large-scale projects . [From Wikipedia]

CYTHON :

Cython is a programming language that aims to be a superset of the Python programming language . Cython is a compiled language that is typically used to generate CPython extension modules. Annotated Python-like code is compiled to C or C++ then automatically wrapped in interface code. Cython is written in Python and C and works on Windows, macOS, and Linux, producing source files compatible with CPython 2.6, 2.7, and 3.3 and later versions.

Results :

Performance and Speed

As mentioned earlier, Python is an interpreted programming language, whereas Cython is a compiled programming language. Despite being a superset of Python, Cython is much faster than Python. It improves Python code execution speed significantly by compiling Python code into C code. The compilation further helps developers to run the Python programs smoothly without deploying additional computing resources. Hence, many programmers to opt for Cython to write concise and readable code in Python that perform as faster as C code.

Plots of Difference

Developers

ID First & Last Name
@baqermarani Mohamadbaqer Marani

GitHub

View Github