Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: speed up matching types in the ServiceBrowser #1144

Merged
merged 1 commit into from Apr 2, 2023

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Apr 2, 2023

Avoids some isinstance checks and uses an lru to generate the possible types. The LRU has a good hit rate:

2023-04-02 05:46:07.886 CRITICAL (SyncWorker_8) [homeassistant.components.profiler] Cache stats for lru_cache <function possible_types at 0x7f0e818d4dc0> at /usr/local/lib/python3.10/site-packages/zeroconf/_utils/name.py: CacheInfo(hits=1989, misses=375, maxsize=256, currsize=256)
2023-04-02 05:47:07.352 CRITICAL (SyncWorker_13) [homeassistant.components.profiler] Cache stats for lru_cache <function possible_types at 0x7f0e818d4dc0> at /usr/local/lib/python3.10/site-packages/zeroconf/_utils/name.py: CacheInfo(hits=2283, misses=387, maxsize=256, currsize=256)
2023-04-02 05:48:04.247 CRITICAL (SyncWorker_15) [homeassistant.components.profiler] Cache stats for lru_cache <function possible_types at 0x7f0e818d4dc0> at /usr/local/lib/python3.10/site-packages/zeroconf/_utils/name.py: CacheInfo(hits=2615, misses=387, maxsize=256, currsize=256)

@codecov-commenter
Copy link

codecov-commenter commented Apr 2, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (36d5b45) 99.76% compared to head (6a8f079) 99.76%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1144   +/-   ##
=======================================
  Coverage   99.76%   99.76%           
=======================================
  Files          22       22           
  Lines        2605     2608    +3     
  Branches      456      455    -1     
=======================================
+ Hits         2599     2602    +3     
  Misses          4        4           
  Partials        2        2           
Impacted Files Coverage Δ
src/zeroconf/__init__.py 100.00% <100.00%> (ø)
src/zeroconf/_services/browser.py 99.13% <100.00%> (+<0.01%) ⬆️
src/zeroconf/_utils/name.py 98.41% <100.00%> (+0.05%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@bdraco bdraco merged commit 68871c3 into master Apr 2, 2023
28 checks passed
@bdraco bdraco deleted the speed_up_matching_types branch April 2, 2023 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants