Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yisuschrist/python_multiprocessing_sample
Simple python script to demonstrate multiprocessing techniques using different approaches.
https://github.com/yisuschrist/python_multiprocessing_sample
multiprocessing proof-of-concept python
Last synced: about 11 hours ago
JSON representation
Simple python script to demonstrate multiprocessing techniques using different approaches.
- Host: GitHub
- URL: https://github.com/yisuschrist/python_multiprocessing_sample
- Owner: YisusChrist
- License: gpl-3.0
- Created: 2024-03-02T18:51:19.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-03-02T19:37:28.000Z (9 months ago)
- Last Synced: 2024-03-02T20:38:16.299Z (9 months ago)
- Topics: multiprocessing, proof-of-concept, python
- Language: Python
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Sample code to test the performance of different ways to process a list of numbers using classic, list comprehension, and multiprocessing methods.
Table of Contents
- [Introduction](#introduction)
- [Prerequisites](#prerequisites)
- [Usage](#usage)
- [Options](#options)
- [Results](#results)
- [License](#license)
- [Credits](#credits)# Introduction
This Python script provides a comparison of different approaches to processing a list of numbers. It includes three methods:
- `Classic iteration`
- `List comprehension`
- `Multiprocessing`The script measures the execution time for each method and compares their performance.
# Prerequisites
- Python 3.7 or later
- Rich library (optional, for enhanced console output)> [!NOTE]
> The software has been developed and tested using Python `3.12.1`. The minimum required version to run the software is Python 3.7. Although the software may work with previous versions, it is not guaranteed.# Usage
1. Clone the repository:
```sh
git clone https://github.com/YisusChrist/python_multiprocessing_sample.git
```2. Navigate to the project directory:
```sh
cd python_multiprocessing_sample
```3. Run the script:
```sh
python main.py
```# Options
- `DIVIDE`: Boolean flag to determine whether to divide or multiply the numbers.
- `MAX_NUMBER`: The maximum number used in the processing function.
- `TEST_SIZE`: Size of the list of numbers to process.# Results
The script will display the execution time for each method along with the first few processed numbers.
# License
This project is released under the [GPL-3.0 License](https://opensource.org/licenses/GPL-3.0).
# Credits
Special thanks to [Julynx](https://github.com/Julynx) for the inspiration to create this project. He provided the idea and the initial code to compare the performance of different methods to process a list of numbers.
The version published here is an enhanced and more complete version of the original code.