Skip to content

feat: optimize the dns cache#1119

Merged
bdraco merged 11 commits into
masterfrom
dns_pxd_v2
Dec 21, 2022
Merged

feat: optimize the dns cache#1119
bdraco merged 11 commits into
masterfrom
dns_pxd_v2

Conversation

@bdraco

@bdraco bdraco commented Dec 20, 2022

Copy link
Copy Markdown
Member

This adds a pxd file for _cache.py and cleans up the one for _dns.py

This also fixes some conflating of DNSRecord and DNSEntry

@codecov-commenter

codecov-commenter commented Dec 20, 2022

Copy link
Copy Markdown

Codecov Report

Base: 99.72% // Head: 99.72% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (6ce07c6) compared to base (81e186d).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1119   +/-   ##
=======================================
  Coverage   99.72%   99.72%           
=======================================
  Files          22       22           
  Lines        2567     2569    +2     
  Branches      454      452    -2     
=======================================
+ Hits         2560     2562    +2     
  Misses          5        5           
  Partials        2        2           
Impacted Files Coverage Δ
src/zeroconf/__init__.py 100.00% <100.00%> (ø)
src/zeroconf/_cache.py 100.00% <100.00%> (ø)
src/zeroconf/_dns.py 100.00% <100.00%> (ø)

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 at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Comment thread src/zeroconf/_dns.py
@@ -487,7 +483,7 @@ def __eq__(self, other: Any) -> bool:
isinstance(other, DNSNsec)
and self.next_name == other.next_name

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can move all the checks after the isinstance into a cdef with the other typed to the same type which will avoid all the python accessor overhead since we can access the struct values in C instead

@bdraco

bdraco commented Dec 21, 2022

Copy link
Copy Markdown
Member Author

Worked great overnight. #1119 (comment) can happen in another PR

@bdraco bdraco marked this pull request as ready for review December 21, 2022 20:38
@bdraco bdraco merged commit e80fcef into master Dec 21, 2022
@bdraco bdraco deleted the dns_pxd_v2 branch December 21, 2022 20:38
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.

2 participants