feat: speed up incoming packet reader by bdraco · Pull Request #1314 · python-zeroconf/python-zeroconf
Conversation
This is ~14% speed up
before: Parsing 100000 incoming messages took 2.3616396670695394 seconds
after: Parsing 100000 incoming messages took 2.012439667014405 seconds
bdraco
changed the title
feat: speed up outgoing packet writer
feat: speed up incoming packet reader
Codecov Report
All modified and coverable lines are covered by tests ✅
Comparison is base (
55cf4cc) 99.77% compared to head (872591a) 99.77%.
Report is 2 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@ ## master #1314 +/- ## ======================================= Coverage 99.77% 99.77% ======================================= Files 29 29 Lines 3053 3079 +26 Branches 513 516 +3 ======================================= + Hits 3046 3072 +26 Misses 5 5 Partials 2 2
☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.
I think this still has potential if we use an lru since 99% of the data is the same
Type, class can be one key
Maybe similar to how we do it in aioesphomeapi. Use a cache wrapper that cython can convert from memory view to bytes and than py int to uint
Should work because view is really bytes on pure python anyways.
But is it faster...?
bdraco
marked this pull request as ready for review
bdraco
deleted the
refactor_packets
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