This repository contains two implementations of the same project in Rust and Python to compare their performance in calculating prime numbers.
├── python
│ ├── main.py
│ └── requirements.txt
├── README.md
└── rust
├── Cargo.lock
├── Cargo.toml
├── src
└── target
- Navigate to the
python
folder:
cd python
- Create and activate environment
python -m venv .env
source .env/bin/activate # Use `.env\Scripts\activate` on Windows
- Install any required dependencies:
pip install -r requirements.txt
- Run the program
python main.py
- Navigate to the
rust
folder:
cd rust
- Build the project
cargo run build
- Run the project
cargo run --release
Each implementation calculates all prime numbers up to 10 million. The time taken for execution will be printed to the console after running the programs.
- Python: Execution time is measured using the built-in time module.
- Rust: Use std::time for basic measurement, or integrate criterion for advanced benchmarking.
Feel free to fork the repository, open issues, or submit pull requests to improve the implementations or add new comparisons.