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: simplify code to unpack properties #1237

Merged
merged 2 commits into from Aug 27, 2023
Merged

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Aug 27, 2023

This is one of most common operations from discovery so anything we can do to improve the performance here is a win.

We may need to cython

@codecov
Copy link

codecov bot commented Aug 27, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.04% ⚠️

Comparison is base (bd8d846) 99.82% compared to head (77b853a) 99.78%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1237      +/-   ##
==========================================
- Coverage   99.82%   99.78%   -0.04%     
==========================================
  Files          25       25              
  Lines        2809     2805       -4     
  Branches      480      479       -1     
==========================================
- Hits         2804     2799       -5     
  Misses          3        3              
- Partials        2        3       +1     
Files Changed Coverage Δ
src/zeroconf/__init__.py 100.00% <100.00%> (ø)
src/zeroconf/_services/info.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines -364 to -368
for s in strs:
key, _, value = s.partition(b'=')
# Only update non-existent properties
if key and key not in result:
result[key] = value or None
Copy link
Member Author

Choose a reason for hiding this comment

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

This was O(n)*2 + the cost of the python loop

@bdraco bdraco marked this pull request as ready for review August 27, 2023 19:22
@bdraco
Copy link
Member Author

bdraco commented Aug 27, 2023

retest is good

@bdraco bdraco merged commit 68d9998 into master Aug 27, 2023
33 of 34 checks passed
@bdraco bdraco deleted the unpack_properties_cleanup branch August 27, 2023 19:22
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

1 participant