feat: simplify code to unpack properties by bdraco · Pull Request #1237 · python-zeroconf/python-zeroconf
Conversation
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
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 |
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
marked this pull request as ready for review
bdraco
deleted the
unpack_properties_cleanup
branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters