A quick comparison among Python, Cython, and the C languages

A quick comparison among Python, Cython, and the C languages. A Programming Assignment regarding the Programming Language Design course

Runtime analysis of code with plotting

A quick comparison among Python, Cython, and the C languages. A Programming Assignment regarding the Programming Language Design course. (Fall 2021)

About The Project

In this project, we are comparing the execution time of four different approaches, including :

  • Pure C
  • Optimized Cython
  • Non-Optimized Cython
  • Pure Python

Built With

Getting Started

Prerequisites

  • Python 3, An IDE
  • C compiler (gcc, …)
  • Cython lib
  • matplotlib

Installation

  • Clone the repo
     git clone https://github.com/CenaAshoori/sort_cython
    
  • Install requirement :
    pip install cython
    pip install matplotlib
    

Usage

Cython enables you to create extension modules from Python, Cython, or C code to a compiled version of it, which is much faster compared to just using python.

Numpy, for example, uses this method

How it Works

we have implemented bubble sort in 4 diffrent methods :

  1. C
  2. An optimized Cython
  3. Non optimized Cython
  4. Python

Initially, you will need to build these three codes, and after that, you can import them into the run.py file.

  python setup.py build_ext --inplace

Check out the Cython documentation to learn how it works, and how you can change the bubble sort to a different algorithm!
Good luck!

Testing and Screenshots

### Screenshots:

License

Distributed under the MIT License. See LICENSE for more information.

Author Info:

First and Last NameGithub
Mohammad Hossein(Cena) AshooriLink
Mohammad Mehdi AfkhamiLink
Parsa KamaliPourLink