Skip to content

feat: simplify code to unpack properties#1237

Merged
bdraco merged 2 commits into
masterfrom
unpack_properties_cleanup
Aug 27, 2023
Merged

feat: simplify code to unpack properties#1237
bdraco merged 2 commits into
masterfrom
unpack_properties_cleanup

Conversation

@bdraco

@bdraco bdraco commented Aug 27, 2023

Copy link
Copy Markdown
Member

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

codecov Bot commented Aug 27, 2023

Copy link
Copy Markdown

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
Copy Markdown
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

bdraco commented Aug 27, 2023

Copy link
Copy Markdown
Member Author

retest is good

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.

1 participant