subinterpreters for asyncio.
Project description
async-interpreters
subinterpreters for asyncio
Usage
from async_interpreters import WorkersPool
workers = WorkersPool(max_size=10, timeout=5)
def calc_sum(a, b):
sum = a
for i in range(b):
sum += i
return sum
async def usage():
await workers.run_sync(calc_sum, 10, 100_000_000)
async def benchmark():
t = time.perf_counter()
await asyncio.gather(*(usage() for _ in range(10)))
print(time.perf_counter() - t)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file async_interpreters-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: async_interpreters-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4bae81e155da61cc1a4526af82ea226094822016e46650f4ed1586b164ca16f |
|
MD5 | a4e53fe8d6938664165a1368f78da80b |
|
BLAKE2b-256 | 2c1e6dc6a141fc79f54c9435fcd98b6e4eb5be85b5b2bc4b9466d6712b37cb2d |