Skip to content

Instantly share code, notes, and snippets.

View dongyuzheng's full-sized avatar

Gary dongyuzheng

  • 17:34 (UTC -05:00)
View GitHub Profile
@dongyuzheng
dongyuzheng / benchmark_requests.py
Last active October 6, 2022 15:35
Benchmark of serial `requests` vs. `aiohttp` vs. `ThreadPoolExecutor` vs. `ProcessPoolExecutor`
#!/usr/bin/env python3
import asyncio
import time
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
from contextlib import contextmanager
import aiohttp
import requests