/async_vs_sync_python

EN: A repository comparing asynchronous and synchronous task execution in Python, showcasing performance differences between asyncio and time.sleep. PT-BR: Repositório que compara a execução assíncrona e síncrona de tarefas em Python, destacando as diferenças de desempenho entre asyncio e time.sleep.

Primary LanguagePython

Asynchronous vs Synchronous Task Execution in Python

This repository compares asynchronous and synchronous task execution in Python, showcasing performance differences between asyncio and time.sleep.

Comparison

Asynchronous Programming (asyncio):

  • Allows concurrent execution of tasks.
  • Total execution time is close to that of a single task (around 2 seconds).

Synchronous Programming (time.sleep):

  • Executes tasks sequentially, blocking program execution.
  • Total execution time is the sum of all tasks (around 6 seconds).

Async running

async

Sync running

sync