FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-zeroconf/bench/create_destory.py at master · python-zeroconf/python-zeroconf · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
python-zeroconf
/
python-zeroconf
Public
Notifications
You must be signed in to change notification settings
Fork
230
Star
734
Code
Issues
46
Pull requests
8
Discussions
Actions
Projects
Wiki
Security and quality
5
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
python-zeroconf
/
bench
/
create_destory.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
24 lines (15 loc) · 555 Bytes
Breadcrumbs
python-zeroconf
/
bench
/
create_destory.py
Copy path
File metadata and controls
24 lines (15 loc) · 555 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""Benchmark for AsyncZeroconf."""
import
asyncio
import
time
from
zeroconf
.
asyncio
import
AsyncZeroconf
iterations
=
10000
async
def
_create_destroy
(
count
:
int
)
->
None
:
for
_
in
range
(
count
):
async
with
AsyncZeroconf
()
as
zc
:
await
zc
.
zeroconf
.
async_wait_for_start
()
async
def
_run
()
->
None
:
start
=
time
.
perf_counter
()
await
_create_destroy
(
iterations
)
duration
=
time
.
perf_counter
()
-
start
print
(
f"Creating and destroying
{
iterations
}
Zeroconf instances took
{
duration
}
seconds"
)
asyncio
.
run
(
_run
())
Back
|
FazBrowse Home
|
New Git URL