Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import asyncio
- import time
- import numpy as np
- import redis.asyncio as redis
- async def bench_gather(number: int):
- rd = redis.Redis(port=9998)
- async def create_value(key: str, value: bytes):
- start = time.monotonic()
- await rd.set(key, value)
- return time.monotonic() - start
- results = []
- for i in range(number):
- results.append(await create_value(f"test_{i}", b"test_value"))
- return results
- np.set_printoptions(suppress=True, precision=16)
- results = np.array(asyncio.run(bench_gather(10000)))
- print("Max write time")
- print(f"{results.max():.16f}")
- print("Min write time")
- print(f"{results.min():.16f}")
- print("Avg write time")
- print(f"{results.mean():.16f}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement