This project aims to explore different forms of concurrency and, when possible, parallelism, using Python. Each explored form contains visual graphics, with the aid of Matplotlib, to show the achieved performance benefits in terms of the reduction of the total computing time.
Some techniques may be better suited for some types of problems than others. Two main problems are included:
-
I/O bound problems
: problems that are limited by the I/O systems such as hard drive disk accesses, network requests, databases accesses, etc. -
CPU bound problems
: problems that are limited by the speed of the CPU such as mathematical computations like matrices multiplications, summations, etc.
Hence, the problems
folder will contain these type of problems to test different algorithms against.
As the project grows, different techniques and strategies may be included. For starters, two main types of algorithms are introduced:
- Synchronous code (naive solutions);
- Asynchronous code with multi-threading;
- Asynchronous code with coroutines and event loops;
- Parallel programming.
The program executed 15 requests and registered the total time of the sync project:
After installing the requirements with Pipfile
, to run the project, use a Python 3.7.5+ interpreter with
the desired problem type
and algorithm type
:
--problem-type
: can be eitherio-bound
orcpu-bound
;--algorithm-type
: can be eithersync
orasync-threads
; (more to come soon!)
Examples:
python main.py --problem-type io-bound --algorithm-type sync
python main.py --problem-type io-bound --algorithm-type async-threads
Run all the tests with pytest
!
pytest -vv