Skip to content

Instantly share code, notes, and snippets.

View leemurus's full-sized avatar
🏠
Working from home

Anton Sidorevich leemurus

🏠
Working from home
  • Apostro
  • Belgrade
  • 22:05 (UTC +02:00)
  • LinkedIn in/leemurus
View GitHub Profile
@leemurus
leemurus / requests.py
Created January 27, 2023 20:20
httpx vs aiohttp
import aiohttp
import asyncio
import time
import httpx
def print_performance(func):
async def wrapper(*args, **kwargs):
begin = time.monotonic()
@leemurus
leemurus / test_async.py
Last active January 28, 2023 17:09
How effective is asynchrony for synchronous tasks?
import asyncio
import time
def sync_print_performance(func):
def wrapper(*args, **kwargs):
begin = time.monotonic()
result = func(*args, **kwargs)
duration = time.monotonic() - begin
print(f'Time execution of {func.__name__}: {duration * 1000:.2f} ms')
import re
import requests
import time
from bs4 import BeautifulSoup
from selectolax.parser import HTMLParser
def print_performance(func):
def wrapper(*args, **kwargs):