Skip to content

Latest commit

 

History

History
56 lines (39 loc) · 2.63 KB

README.md

File metadata and controls

56 lines (39 loc) · 2.63 KB

Python script for data processing in Rust, highlighting the improvements in speed and resource usage

Runtime CI/CD

Overview

The repo focuses towards comparing improvements in speed and resource usage for using rust against python.

Code Description

I used criterion for Rust and pytest-benchmark for Python for benchmarking. Rust took 130ms and Python took 767ms to execute the same code. Rust around 6 times faster to Calculate sum of squares for the first 10 million natural numbers as compared to python.

To execute rust file :

  1. Install Rust (curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh)
  2. Install the rust-analyzer extension
  3. A good way to create Rust program is to use Cargo to scaffold a new project by typing cargo new. This will create a simple Hello World program along with a default Cargo.toml dependency file. You pass cargo new the folder where you'd like to create the project.
    • cargo new rust_time
  4. Cargo new creates a project with a main.rs source code file and Cargo.toml Cargo manifest file.
  5. main.rs has the program's entry function main() and prints "Hello, world!" to the console using println!.
  6. The output :

My Image2

To execute python file :

  1. Install pytest-benchmark
  2. run the command pytest python.py
  3. The output :

My Image2

CI/CD Automation files

  1. requirements.txt - Contains all the required python packages

  2. Makfefile - Using make to automate different parts of developing a Python project, like -

    1. running tests
    2. cleaning builds
    3. installing dependencies
    

    Integrating it into my routine, so can save time and avoid errors.

  3. .github/workflows - This directory in a Python project (or any GitHub repository) is used for creating and storing GitHub Actions workflows. GitHub Actions is a continuous integration and continuous delivery (CI/CD) platform provided by GitHub. The workflow is triggered on pushes to the main branch. It sets up :

    1. Python environment
    2. Installs project dependencies
    3. Install packages
    4. Linitng
    5. Runs tests
    6. Format