- Notifications
You must be signed in to change notification settings - Fork1
Concurrency and Parallelism in Python: thread x multiprocess x async-io
License
leogregianin/python-concurrency-and-parallelism
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Concurrency and parallelism in Python
Concurrency is about dealing with lots of things at once. Parallelism is about doing lots of things at once.-- Rob Pike, co-inventor da linguagem Go - Concurrency is not Parallelism (it's better)
Ao preparar vários pratos ao mesmo tempo o cozinheiro está trabalhando de forma concorrente, porque normalmente ele só cuida de um prato por vez, mas vários estão sendo preparados ao mesmo tempo.Por outro lado, um fogão de 6 bocas permite aquecer 6 panelas em paralelo.Ou seja, o cozinheiro trabalha em modo concorrente e o fogão em modo paralelo.--Garoa Hacker Clube
* pipenv installor* requests* asyncio* aiohttp* httpx
Benchmark name | (1) | (2) | (3) | (4) | (5) | (6) |
---|---|---|---|---|---|---|
synchronous (sync.py) | 17.36607 | 17.22630 | 15.45768 | 15.19582 | 5.01565 | 4.41665 |
thread with 5 workers (thread.py) | 3.24835 | 2.75820 | 1.84323 | 1.81323 | 0.50936 | 0.51072 |
thread with 50 workers (thread.py) | 0.62569 | 0.75663 | 0.57323 | 0.58774 | 0.29404 | 0.25039 |
parallelism (multiprocess.py) | 3.60770 | 3.31779 | 2.84597 | 2.70542 | 0.37044 | 0.36182 |
asynchronous coroutines (async.py) | 0.58660 | 0.60951 | 0.57161 | 0.57969 | 0.27758 | 0.23457 |
- Time in seconds
- (1) with Python 3.6.5 (win32)
- (2) with Python 3.6.5 (win32)
- (3) with Python 3.8.0 (win32)
- (4) with Python 3.8.0 (win32)
- (5) with Python 3.7.4 (linux gcc 8.3.0)
- (6) with Python 3.7.4 (linux gcc 8.3.0)
- [en]Coroutines and Tasks - Official Python Docs
- [en]threading — Thread-based parallelism - Official Python Docs
- [en]multiprocessing — Process-based parallelism - Official Python Docs
- [en]Speed Up Your Python Program With Concurrency
- [en]An Intro to Threading in Python
- [en]Async IO in Python: A Complete Walkthrough
- [en]AsyncIO for the Working Python Developer - Yeray Diaz
- [pt-br]AsyncIO - O futuro do Python mudou completamente! - Bruno Rocha
About
Concurrency and Parallelism in Python: thread x multiprocess x async-io
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.