Skip to content

feat: optimize equality checks for DNS records#1120

Merged
bdraco merged 4 commits into
masterfrom
dns_cache_eq_opt
Dec 22, 2022
Merged

feat: optimize equality checks for DNS records#1120
bdraco merged 4 commits into
masterfrom
dns_cache_eq_opt

Conversation

@bdraco
Copy link
Copy Markdown
Member

@bdraco bdraco commented Dec 21, 2022

By moving some of the equality checking to cdefs we can avoid the generic python accessors and access the properties directly on the object. This can only be done once it passes the isinstance check for the same type.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Dec 21, 2022

Codecov Report

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

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

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1120   +/-   ##
=======================================
  Coverage   99.72%   99.72%           
=======================================
  Files          22       22           
  Lines        2567     2590   +23     
  Branches      454      456    +2     
=======================================
+ Hits         2560     2583   +23     
  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%> (ø)
src/zeroconf/_protocol/incoming.py 98.85% <100.00%> (+<0.01%) ⬆️

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 Outdated
@bdraco bdraco force-pushed the dns_cache_eq_opt branch 2 times, most recently from 934ee37 to 12b2fb5 Compare December 21, 2022 21:44
By moving some of the equality checking to `cdef`s we can avoid
the generic python accessors and access the properties directly
on the object. This can only be done once it passes the `isinstance`
check for the same type.
@bdraco
Copy link
Copy Markdown
Member Author

bdraco commented Dec 21, 2022

Looks like the tests are failing because of a bug I fixed with server_key. I'll need to unfix that here and make a new PR to fix that.

@bdraco
Copy link
Copy Markdown
Member Author

bdraco commented Dec 21, 2022

reverted the fix here and opened #1121

Will make a PR for that

Comment thread src/zeroconf/_dns.pxd Outdated
@bdraco bdraco closed this Dec 22, 2022
@bdraco bdraco reopened this Dec 22, 2022
@bdraco
Copy link
Copy Markdown
Member Author

bdraco commented Dec 22, 2022

Screenshot 2022-12-21 at 4 45 06 PM

This is what is left that still takes a bit of time which is a wrapper around the incoming parser.

@bdraco bdraco marked this pull request as ready for review December 22, 2022 02:49
@bdraco bdraco merged commit 3a25ff7 into master Dec 22, 2022
@bdraco bdraco deleted the dns_cache_eq_opt branch December 22, 2022 02:49
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