We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1b5cc24 commit 72fed78Copy full SHA for 72fed78
1 file changed
bench/create_destory.py
@@ -0,0 +1,23 @@
1
+"""Benchmark for AsyncZeroconf."""
2
+import asyncio
3
+import time
4
+
5
+from zeroconf.asyncio import AsyncZeroconf
6
7
+iterations = 10000
8
9
10
+async def _create_destroy(count: int) -> None:
11
+ for _ in range(count):
12
+ async with AsyncZeroconf() as zc:
13
+ await zc.zeroconf.async_wait_for_start()
14
15
16
+async def _run() -> None:
17
+ start = time.perf_counter()
18
+ await _create_destroy(iterations)
19
+ duration = time.perf_counter() - start
20
+ print(f"Creating and destroying {iterations} Zeroconf instances took {duration} seconds")
21
22
23
+asyncio.run(_run())
0 commit comments